Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2010-04-01 19:18:59 -0400
committerStephan Herrmann2010-04-01 19:18:59 -0400
commit36c2699a5a822d111414304e5175725d23449493 (patch)
tree5af78664455cc8565146749f3d68d70823029bd3 /testplugins/org.eclipse.objectteams.otdt.ui.tests
parent0c152ef43e54ba1f27b4e54097615d0e774541fb (diff)
downloadorg.eclipse.objectteams-36c2699a5a822d111414304e5175725d23449493.tar.gz
org.eclipse.objectteams-36c2699a5a822d111414304e5175725d23449493.tar.xz
org.eclipse.objectteams-36c2699a5a822d111414304e5175725d23449493.zip
initial commit in accordance with CQ 3784
Diffstat (limited to 'testplugins/org.eclipse.objectteams.otdt.ui.tests')
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/.classpath8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/.cvsignore1
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/.project29
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/.settings/org.eclipse.jdt.core.prefs52
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/META-INF/MANIFEST.MF34
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/build.properties12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/plugin.xml19
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/AllTests.java48
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/FileBasedUITest.java42
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/TestPlugin.java122
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/callinmarker/CallinMarkerTests.java446
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/AllTests.java43
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/ExternalDefinedRoleContentAndParentTests.java513
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/InternalDefinedRoleContentAndParentTests.java498
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/Logger.java50
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/TeamContentTests.java291
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddImportQuickFixTest.java388
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddUnimplementedMethodsTest.java198
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CallinQuickFixTest.java177
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CalloutQuickFixTest.java417
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java1350
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CompletionTestSetup.java77
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ModifierCorrectionsQuickFixTest.java420
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTJavadocQuickFixTest.java155
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTQuickFixTest.java92
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OrganizeImportsTest.java836
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProjectTestSetup.java104
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProposalAdaptor.java42
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/StringAsserts.java200
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/UnresolvedMethodsQuickFixTest.java536
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/AllTests.java42
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/Comparator.java27
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/ITypeComparator.java41
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java366
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/SuperHierarchyContentProviderTests.java464
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java120
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllInternalRoleCreationTests.java97
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllTests.java45
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/NewTeamWizardPageListenerTest.java56
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/RoleCreationTests.java896
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/TeamCreationTests.java401
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/JavaProjectHelper.java144
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/TestOptions.java611
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/test.xml66
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/.classpath8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/.project18
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/bar/BaseTeam.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/bar/TeamTeam.java7
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/cycle/Base1.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/cycle/CTeam.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/Main.java14
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyBase.java24
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyTeam.java35
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyTeam2.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyTeam2/R2.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/.classpath11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/.project18
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/ordinarypkg/EmptyClass.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/ordinarypkg/InterfaceWithOneMethod.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/ordinarypkg/InterfaceWithTwoMethods.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/AbstractTeamWithAbstractMethod.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/EmptyBaseTeam.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyEmpty.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyWithOneRole.java13
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclass_PreviouslyEmpty.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclass_PreviouslyWithOneRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithImplicitSuperClassAndInheritedMethod.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithOneSuperInterface.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithOneSuperInterfaceAndInheritedMethod.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithOrdinaryBase.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithSeveralSuperInterfaces.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithSeveralSuperInterfacesAndInheritedMethods.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithSeveralSuperTypesAndInheritedMethods.java13
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithTeamBase.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForSimpleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForSimpleRole_PreviouslyWithOneRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForSimpleRole_PreviouslyWithTwoRoles.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamWithRoleWithAbstractMethod.java13
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/teams/ordinarypkg/InterfaceWithOneMethod.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/teams/teampkg/AbstractTeamWithAbstractMethod.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/teams/teampkg/TeamForNestedTeam.java5
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/.classpath14
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/.project18
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/basepkg/SampleBase.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_1.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_1/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_2.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_2/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3a.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3a/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3b.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3b/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3c.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3c/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3d.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3d/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4a.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4a/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4b.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4b/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5a.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5a/SampleRole.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5b.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5b/SampleRole.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5c.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5c/SampleRole.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5d.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5d/SampleRole.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5e.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5e/SampleRole.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/TeamB.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_1.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_1/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_2.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_2/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3a.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3a/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3b.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3b/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3c.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3c/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3d.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3d/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4a.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4a/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4b.java8
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4b/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5a.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5a/SampleRole.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5b.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5b/SampleRole.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5c.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5c/SampleRole.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5d.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5d/SampleRole.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5e.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5e/SampleRole.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_1.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_1/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_2.java11
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_2/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3a.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3a/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3b.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3b/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3c.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3c/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3d.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3d/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4a.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4a/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4b.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4b/SampleRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/.classpath13
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/.project18
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/basepkg/SampleBase.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_1.java13
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_2.java16
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3a.java17
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3b.java17
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3c.java17
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3d.java17
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_4a.java17
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_4b.java17
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5a.java19
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5b.java19
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5c.java19
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5d.java19
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5e.java19
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/TeamB.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/TeamC.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_1.java13
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_2.java16
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3a.java17
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3b.java17
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3c.java17
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3d.java17
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_4a.java17
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_4b.java17
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5a.java19
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5b.java19
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5c.java19
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5d.java19
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5e.java19
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/ordinaryclasses/ordinaryclasses/EmptyClass.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/unbound/teampkg/TeamWithRoleWithImplicitSuperRole.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/unbound/teampkg/TeamWithRoleWithOrdinarySuperClass.java13
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/unbound/teampkg/TeamWithTwoRolesInInheritanceRelation.java13
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/unbound/teampkg/Team_1.java12
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/unbound/teampkg/Team_2.java15
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/unbound/teampkg/Team_3a.java16
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/unbound/teampkg/Team_3b.java16
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/unbound/teampkg/Team_3c.java16
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/unbound/teampkg/Team_3d.java16
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/unbound/teampkg/Team_4a.java16
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/unbound/teampkg/Team_4b.java16
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/NonJavaPrj/.project7
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/NonJavaPrj/folder/File.java4
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/TeamProject/.classpath10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/TeamProject/.project18
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/TeamProject/src/teampkg/EmptyTeam.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/TeamProject/src/teampkg/TeamWithExternalDefinedRoleClass.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/TeamProject/src/teampkg/TeamWithExternalDefinedRoleClass/RoleClass.java9
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/TeamProject/src/teampkg/TeamWithField.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/TeamProject/src/teampkg/TeamWithInnerTeamClass.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/TeamProject/src/teampkg/TeamWithMethodWithParameter.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/TeamProject/src/teampkg/TeamWithMethodWithReturnValue.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/TeamProject/src/teampkg/TeamWithMethodWithThrowClause.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/TeamProject/src/teampkg/TeamWithParameterlessMethod.java10
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/TeamProject/src/teampkg/TeamWithRoleClass.java10
210 files changed, 12539 insertions, 0 deletions
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/.classpath b/testplugins/org.eclipse.objectteams.otdt.ui.tests/.classpath
new file mode 100644
index 000000000..b05df526d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="OTRE"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/.cvsignore b/testplugins/org.eclipse.objectteams.otdt.ui.tests/.cvsignore
new file mode 100644
index 000000000..ba077a403
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/.project b/testplugins/org.eclipse.objectteams.otdt.ui.tests/.project
new file mode 100644
index 000000000..66269913d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/.project
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.objectteams.otdt.ui.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/.settings/org.eclipse.jdt.core.prefs b/testplugins/org.eclipse.objectteams.otdt.ui.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..37bc5a4d2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,52 @@
+#Thu Mar 08 23:10:44 CET 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/META-INF/MANIFEST.MF b/testplugins/org.eclipse.objectteams.otdt.ui.tests/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..21a390311
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,34 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OTDT UITests Plug-in
+Bundle-SymbolicName: org.eclipse.objectteams.otdt.ui.tests;singleton:=true
+Bundle-Version: 1.3.0
+Bundle-ClassPath: otdt-uitests.jar
+Bundle-Activator: org.eclipse.objectteams.otdt.ui.tests.TestPlugin
+Bundle-Vendor: The TOPPrax consortium
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.junit,
+ org.eclipse.objectteams.otdt.tests,
+ org.eclipse.jdt.ui,
+ org.eclipse.jdt.core,
+ org.eclipse.ui.ide,
+ org.eclipse.objectteams.otdt.ui,
+ org.eclipse.core.resources,
+ org.eclipse.jface.text,
+ org.eclipse.jdt.core.tests.compiler,
+ org.eclipse.test.performance,
+ org.eclipse.objectteams.otdt,
+ org.eclipse.jdt.ui.tests,
+ org.eclipse.ui.editors,
+ org.eclipse.objectteams.otequinox;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.objectteams.otdt.jdt.ui
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.objectteams.otdt.ui.tests,
+ org.eclipse.objectteams.otdt.ui.tests.callinmarker,
+ org.eclipse.objectteams.otdt.ui.tests.contentprovider,
+ org.eclipse.objectteams.otdt.ui.tests.core,
+ org.eclipse.objectteams.otdt.ui.tests.hierarchy.contentprovider,
+ org.eclipse.objectteams.otdt.ui.tests.typecreator,
+ org.eclipse.objectteams.otdt.ui.tests.util
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/build.properties b/testplugins/org.eclipse.objectteams.otdt.ui.tests/build.properties
new file mode 100644
index 000000000..c82640ebe
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/build.properties
@@ -0,0 +1,12 @@
+source.otdt-uitests.jar = src/
+output.otdt-uitests.jar = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ otdt-uitests.jar,\
+ workspace/,\
+ test.xml,\
+ testresources/,\
+ JCL/
+src.includes = .classpath,\
+ .project,\
+ build.properties
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/plugin.xml b/testplugins/org.eclipse.objectteams.otdt.ui.tests/plugin.xml
new file mode 100644
index 000000000..c0f53aeef
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/plugin.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <extension
+ point="org.eclipse.objectteams.otequinox.aspectBindings">
+ <aspectBinding
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/calloutbinding_obj.gif">
+ <basePlugin
+ icon="platform:/plugin/org.eclipse.pde.ui/icons/obj16/plugin_obj.gif"
+ id="org.eclipse.jdt.ui">
+ </basePlugin>
+ <team
+ activation="NONE"
+ class="org.eclipse.objectteams.otdt.ui.tests.core.ProposalAdaptor"
+ icon="platform:/plugin/org.eclipse.objectteams.otdt.ui/icons/ot/team_obj.gif">
+ </team>
+ </aspectBinding>
+ </extension>
+</plugin>
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/AllTests.java
new file mode 100644
index 000000000..1f76bada9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/AllTests.java
@@ -0,0 +1,48 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: AllTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author anklam
+ *
+ * @version $Id: AllTests.java 23495 2010-02-05 23:15:16Z stephan $
+ */
+public class AllTests
+{
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite(
+ "All UI Tests");
+ //$JUnit-BEGIN$
+ suite.addTest(org.eclipse.objectteams.otdt.ui.tests.contentprovider.AllTests.suite());
+ suite.addTest(org.eclipse.objectteams.otdt.ui.tests.typecreator.AllTests.suite());
+ suite.addTest(org.eclipse.objectteams.otdt.ui.tests.hierarchy.contentprovider.AllTests.suite());
+ suite.addTest(org.eclipse.objectteams.otdt.ui.tests.callinmarker.CallinMarkerTests.suite());
+ suite.addTest(org.eclipse.objectteams.otdt.ui.tests.core.OrganizeImportsTest.suite());
+ suite.addTest(org.eclipse.objectteams.otdt.ui.tests.core.CodeCompletionTest.suite());
+ suite.addTest(org.eclipse.objectteams.otdt.ui.tests.core.OTQuickFixTest.suite());
+ //$JUnit-END$
+ return suite;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/FileBasedUITest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/FileBasedUITest.java
new file mode 100644
index 000000000..5381b6b55
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/FileBasedUITest.java
@@ -0,0 +1,42 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: FileBasedUITest.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests;
+
+import org.eclipse.objectteams.otdt.tests.FileBasedTest;
+
+
+/**
+ * @author anklam
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class FileBasedUITest extends FileBasedTest {
+
+ public FileBasedUITest(String name) {
+ super(name);
+ }
+
+ protected String getPluginID() {
+ return "org.eclipse.objectteams.otdt.ui.tests";
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/TestPlugin.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/TestPlugin.java
new file mode 100644
index 000000000..6fb416f8a
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/TestPlugin.java
@@ -0,0 +1,122 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: TestPlugin.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.objectteams.otdt.internal.ui.preferences.GeneralPreferences;
+import org.eclipse.objectteams.otdt.ui.OTDTUIPlugin;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class TestPlugin extends AbstractUIPlugin {
+ //The shared instance.
+ private static TestPlugin plugin;
+ //Resource bundle.
+ private ResourceBundle resourceBundle;
+
+ /**
+ * The constructor.
+ */
+ public TestPlugin() {
+ super();
+ plugin = this;
+ try {
+ resourceBundle = ResourceBundle.getBundle("org.eclipse.objectteams.otdt.ui.tests.TestPluginResources");
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+
+ disableCallinMarkers();
+ }
+
+ private void disableCallinMarkers()
+ {
+ IPreferenceStore store = OTDTUIPlugin.getDefault().getPreferenceStore();
+ store.setValue(GeneralPreferences.CALLIN_MARKER_ENABLED_BOOL, false);
+ OTDTUIPlugin.getDefault().getCallinMarkerCreator().setEnabled(false);
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static TestPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle,
+ * or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = TestPlugin.getDefault().getResourceBundle();
+ try {
+ return (bundle != null) ? bundle.getString(key) : key;
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ return resourceBundle;
+ }
+
+ public File getFileInPlugin(IPath path)
+ {
+ try
+ {
+ URL installURL = new URL(getDefault().getBundle().getEntry("/"), path.toString());
+ URL localURL = Platform.asLocalURL(installURL);
+ return new File(localURL.getFile());
+ }
+ catch (IOException ex)
+ {
+ return null;
+ }
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/callinmarker/CallinMarkerTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/callinmarker/CallinMarkerTests.java
new file mode 100644
index 000000000..90c9b7206
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/callinmarker/CallinMarkerTests.java
@@ -0,0 +1,446 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: CallinMarkerTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.callinmarker;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.Test;
+
+import org.eclipse.core.internal.runtime.RuntimeLog;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.ILogListener;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.objectteams.otdt.core.IOTJavaElement;
+import org.eclipse.objectteams.otdt.core.IOTType;
+import org.eclipse.objectteams.otdt.core.IRoleType;
+import org.eclipse.objectteams.otdt.core.OTModelManager;
+import org.eclipse.objectteams.otdt.internal.ui.callinmarkers.AnnotationHelper;
+import org.eclipse.objectteams.otdt.internal.ui.callinmarkers.CallinMarker;
+import org.eclipse.objectteams.otdt.internal.ui.callinmarkers.CallinMarkerCreator2;
+import org.eclipse.objectteams.otdt.internal.ui.callinmarkers.CallinMarkerJob;
+import org.eclipse.objectteams.otdt.internal.ui.callinmarkers.ResourceMarkable;
+import org.eclipse.objectteams.otdt.ui.tests.FileBasedUITest;
+
+public class CallinMarkerTests extends FileBasedUITest
+{
+ private static String SRC_FOLDER = "src";
+ private IType _baseType;
+ private IResource _baseResource;
+ private MyCallinMarkerCreator _creator;
+
+ private class MyCallinMarkerCreator extends CallinMarkerCreator2
+ {
+ private IJobChangeListener _extraListener;
+ private boolean _finished = false;
+
+ public boolean isFinished()
+ {
+ return _finished;
+ }
+
+ public void reset() {
+ this._finished = false;
+ this._extraListener = null;
+ }
+ public void initialize(IEditorPart targetEditor)
+ {
+ // simulate initialization as performed by CallinMarkerCreator.activeJavaEditorChanged()
+ if (targetEditor != null) {
+ this.fActiveEditor = targetEditor;
+ this.annotationHelper = new AnnotationHelper(targetEditor, targetEditor.getEditorInput());
+ }
+ }
+
+ public void setJobListener(IJobChangeListener listener)
+ {
+ _extraListener = listener;
+ }
+
+ protected void schedule(final CallinMarkerJob job,
+ IStatusLineManager statusLine)
+ {
+ job.addJobChangeListener(new JobChangeAdapter() {
+ public void done(IJobChangeEvent event)
+ {
+ _finished = true;
+ }
+ });
+
+ if (_extraListener != null)
+ job.addJobChangeListener(_extraListener);
+
+ super.schedule(job, statusLine);
+ }
+
+ public boolean hasJob() {
+ return this._currentJob != null;
+ }
+ }
+
+ public CallinMarkerTests(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ if (true)
+ {
+ return new Suite(CallinMarkerTests.class);
+ }
+ junit.framework.TestSuite suite = new Suite(CallinMarkerTests.class.getName());
+ return suite;
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir("CallinMarker");
+
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ _creator = new MyCallinMarkerCreator();
+ _creator.setEnabled(true);
+ System.out.println("Running test: "+this.getName());
+ }
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ if (this._creator != null) {
+ this._creator.setEnabled(false);
+ this._creator = null;
+ }
+ }
+
+ void createNonJavaPrj(String projectName) throws IOException, CoreException {
+ // copy files in project from source workspace to target workspace
+ String sourceWorkspacePath = getSourceWorkspacePath();
+ String targetWorkspacePath = getWorkspaceRoot().getLocation().toFile().getCanonicalPath();
+ copyDirectory(new File(sourceWorkspacePath, projectName), new File(targetWorkspacePath, projectName));
+
+ // create project
+ final IProject project = getWorkspaceRoot().getProject(projectName);
+ IWorkspaceRunnable populate = new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ project.create(null);
+ project.open(null);
+ }
+ };
+ getWorkspace().run(populate, null);
+ }
+
+ private IType getJavaType(String projectName, String srcFolderName, String pkgName, String typeName) throws JavaModelException
+ {
+ ICompilationUnit typeUnit = getCompilationUnit(
+ projectName,
+ srcFolderName,
+ pkgName,
+ typeName +".java");
+ IType typeJavaElem = typeUnit.getType(typeName);
+
+ if ((typeJavaElem != null) && (typeJavaElem.exists()))
+ {
+ return typeJavaElem;
+ }
+ return null;
+ }
+
+ private IRoleType getRole(String srcFolderName, String pkgName, String teamName, String roleName) throws JavaModelException
+ {
+ IType teamJavaElem = getJavaType(getTestProjectDir(), srcFolderName, pkgName, teamName);
+ IOTJavaElement teamOTElem = OTModelManager.getOTElement(teamJavaElem);
+ assertNotNull(teamOTElem);
+
+ IOTType teamType = (IOTType) teamOTElem;
+ IType roleJavaElem = teamType.getRoleType(roleName);
+// IType roleJavaElem = teamJavaElem.getType(roleName); // IOTType.getType() does not return role files!
+ if ((roleJavaElem != null) && (roleJavaElem.exists()))
+ {
+ IRoleType roleOTElem = (IRoleType) OTModelManager.getOTElement(roleJavaElem);
+ return roleOTElem;
+ }
+ return null;
+ }
+
+ private void synchronousCreateMarkers(IResource resource) throws PartInitException, JavaModelException
+ {
+ _creator.reset();
+ // this already triggers activeJavaEditorChanged, if project is a java project:
+ IEditorPart activeEditor = JavaUI.openInEditor(_baseType.getCompilationUnit());
+ if (!this._creator.isFinished() && !this._creator.hasJob()) {
+ // explicitly trigger in non-java projects
+ _creator.initialize(activeEditor);
+ _creator.updateCallinMarkers(new ResourceMarkable(resource), null);
+ }
+ try {
+ while (!_creator.isFinished())
+ {
+ if (PlatformUI.getWorkbench().getDisplay().readAndDispatch())
+ Thread.sleep(20);
+ }
+ }
+ catch (InterruptedException ex) {
+ ex.printStackTrace();
+ fail("Interrupted while waiting for CallinMarkerCreator");
+ }
+ }
+
+ // The markers appear in undefined order, so we need to look them up in a Set
+ private void assertMarkers(Set<String> expectedMarkers, IMarker[] markers)
+ {
+ assertNotNull(markers);
+ assertNotNull(expectedMarkers);
+
+ assertEquals("Wrong number of markers", expectedMarkers.size(), markers.length);
+
+ try {
+ for (int i = 0; i < markers.length; i++)
+ {
+ assertNotNull(markers[i]);
+ String methodId = (String) markers[i].getAttribute(CallinMarker.ATTR_BASE_ELEMENT);
+ assertNotNull("CallinMarker without methodId attribute", methodId);
+
+ boolean isExpected = expectedMarkers.contains(methodId);
+ assertTrue("Unexpected marker found for method id: " + methodId, isExpected);
+ }
+ }
+ catch (CoreException ex) {
+ ex.printStackTrace();
+ fail("CoreException while trying to get marker attribute");
+ }
+ }
+
+ private IMarker[] getCallinMarkers(IResource resource)
+ {
+ try
+ {
+ return resource.findMarkers(CallinMarker.CALLIN_ID, true, IResource.DEPTH_INFINITE);
+ }
+ catch (CoreException ex)
+ {
+ ex.printStackTrace();
+ fail(ex.getMessage());
+ return null; // not reached anyway
+ }
+ }
+
+ public void testMarkers_1() throws JavaModelException, PartInitException
+ {
+ _baseType = getJavaType(getTestProjectDir(), SRC_FOLDER, "foo", "MyBase");
+ _baseResource = _baseType.getResource();
+
+ assertNotNull(_baseResource);
+
+ synchronousCreateMarkers(_baseResource);
+
+ Set<String> expectedMarkers = new HashSet<String>();
+ expectedMarkers.add("=CallinMarker/src<foo{MyBase.java[MyBase~baseMethod");
+ expectedMarkers.add("=CallinMarker/src<foo{MyBase.java[MyBase~bm2");
+ expectedMarkers.add("=CallinMarker/src<foo{MyBase.java[MyBase~bm3");
+ expectedMarkers.add("=CallinMarker/src<foo{MyBase.java[MyBase~bm4");
+
+ IMarker[] markers = getCallinMarkers(_baseResource);
+ assertMarkers(expectedMarkers, markers);
+ }
+
+ /** compute marker although one baseclass is missing. */
+ public void testMarkers_2() throws JavaModelException, PartInitException
+ {
+ _baseType = getJavaType(getTestProjectDir(), SRC_FOLDER, "bar", "BaseTeam");
+ _baseResource = _baseType.getResource();
+
+ assertNotNull(_baseResource);
+
+ synchronousCreateMarkers(_baseResource);
+
+ Set<String> expectedMarkers = new HashSet<String>();
+ expectedMarkers.add("=CallinMarker/src<bar{BaseTeam.java[BaseTeam~murx");
+
+ IMarker[] markers = getCallinMarkers(_baseResource);
+ assertMarkers(expectedMarkers, markers);
+ }
+ /** Base classes have a member-super cycle (OK since they're static members). */
+ public void testMarkers_3() throws JavaModelException, PartInitException
+ {
+ _baseType = getJavaType(getTestProjectDir(), SRC_FOLDER, "cycle", "Base1");
+ _baseResource = _baseType.getResource();
+
+ assertNotNull(_baseResource);
+
+ synchronousCreateMarkers(_baseResource);
+
+ Set<String> expectedMarkers = new HashSet<String>();
+ expectedMarkers.add("=CallinMarker/src<cycle{Base1.java[Base1[Inner~foo");
+
+ IMarker[] markers = getCallinMarkers(_baseResource);
+ assertMarkers(expectedMarkers, markers);
+ }
+
+ // see http://trac.objectteams.org/ot/ticket/188
+ public void testMarkers_NonJavaPrj1() throws CoreException, IOException, InterruptedException
+ {
+ class MyLogListener implements ILogListener {
+ List<IStatus> status = new ArrayList<IStatus>();
+ public void logging(IStatus status, String plugin) {
+ this.status.add(status);
+ }
+ }
+
+ createNonJavaPrj("NonJavaPrj");
+ MyLogListener myLogListener = new MyLogListener();
+ // can't use startLogListening() because we need to listen to RuntimeLog.
+ RuntimeLog.addLogListener(myLogListener);
+
+ try {
+ IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IResource resource = workspaceRoot.findMember(new Path("/NonJavaPrj/folder/File.java"));
+
+ synchronousCreateMarkers(resource);
+
+ // wait for logging to occur after job is done:
+ while(this._creator.isCreatingMarkersFor(resource))
+ Thread.sleep(100);
+
+ if (!myLogListener.status.isEmpty())
+ fail("Unexpected Log: "+myLogListener.status.get(0));
+
+ IMarker[] markers = getCallinMarkers(resource);
+ assertEquals("Should have no markers", markers.length, 0);
+ } finally {
+ RuntimeLog.removeLogListener(myLogListener);
+ deleteProject("NonJavaPrj");
+ }
+ }
+
+ // see http://trac.objectteams.org/ot/ticket/188
+ public void testMarkers_NonJavaPrj2() throws CoreException, IOException, InterruptedException
+ {
+ class MyLogListener implements ILogListener {
+ List<IStatus> status = new ArrayList<IStatus>();
+ public void logging(IStatus status, String plugin) {
+ this.status.add(status);
+ }
+ }
+
+ createNonJavaPrj("NonJavaPrj");
+ MyLogListener myLogListener = new MyLogListener();
+ // can't use startLogListening() because we need to listen to RuntimeLog.
+ RuntimeLog.addLogListener(myLogListener);
+
+ try {
+ IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IResource resource = workspaceRoot.findMember(new Path("/NonJavaPrj/folder/File.java"));
+
+ // cu pretends to exist when previously opened in a java editor
+ JavaUI.openInEditor(JavaCore.create(resource));
+
+ synchronousCreateMarkers(resource);
+
+ // wait for logging to occur after job is done:
+ while(this._creator.isCreatingMarkersFor(resource))
+ Thread.sleep(100);
+
+ if (!myLogListener.status.isEmpty())
+ fail("Unexpected Log: "+myLogListener.status.get(0));
+
+ IMarker[] markers = getCallinMarkers(resource);
+ assertEquals("Should have no markers", markers.length, 0);
+ } finally {
+ RuntimeLog.removeLogListener(myLogListener);
+ deleteProject("NonJavaPrj");
+ }
+ }
+
+ // see http://trac.objectteams.org/ot/ticket/188
+ public void testMarkers_NonJavaPrj3() throws CoreException, IOException, InterruptedException
+ {
+ class MyLogListener implements ILogListener {
+ List<IStatus> status = new ArrayList<IStatus>();
+ public void logging(IStatus status, String plugin) {
+ if (status.getSeverity() == IStatus.ERROR)
+ this.status.add(status);
+ }
+ }
+
+ createNonJavaPrj("NonJavaPrj");
+ MyLogListener myLogListener = new MyLogListener();
+ // can't use startLogListening() because we need to listen to RuntimeLog.
+ RuntimeLog.addLogListener(myLogListener);
+
+ try {
+ IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ // use classfile:
+ IResource resource = workspaceRoot.findMember(new Path("/NonJavaPrj/bin/folder/File.class"));
+
+ // cu pretends to exist when previously opened in a java editor
+ JavaUI.openInEditor(JavaCore.create(resource));
+
+ synchronousCreateMarkers(resource);
+
+ // wait for logging to occur after job is done:
+ while(this._creator.isCreatingMarkersFor(resource))
+ Thread.sleep(100);
+
+ assertEquals("Unexpeted number of log entries", 1, myLogListener.status.size());
+ assertEquals("Unexpected Log",
+ "Status ERROR: org.eclipse.ui code=0 " +
+ "Unable to create editor ID org.eclipse.jdt.ui.ClassFileEditor: " +
+ "The class file is not on the classpath " +
+ "org.eclipse.core.runtime.CoreException: The class file is not on the classpath",
+ myLogListener.status.get(0).toString());
+
+ IMarker[] markers = getCallinMarkers(resource);
+ assertEquals("Should have no markers", markers.length, 0);
+ } finally {
+ RuntimeLog.removeLogListener(myLogListener);
+ deleteProject("NonJavaPrj");
+ }
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/AllTests.java
new file mode 100644
index 000000000..a9dd8bd32
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/AllTests.java
@@ -0,0 +1,43 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: AllTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.contentprovider;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author anklam
+ *
+ * @version $Id: AllTests.java 23495 2010-02-05 23:15:16Z stephan $
+ */
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "All Contentprovider Tests");
+ //$JUnit-BEGIN$
+ suite.addTest(ExternalDefinedRoleContentAndParentTests.suite());
+ suite.addTest(TeamContentTests.suite());
+ suite.addTest(InternalDefinedRoleContentAndParentTests.suite());
+ //$JUnit-END$
+ return suite;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/ExternalDefinedRoleContentAndParentTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/ExternalDefinedRoleContentAndParentTests.java
new file mode 100644
index 000000000..696e5b49b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/ExternalDefinedRoleContentAndParentTests.java
@@ -0,0 +1,513 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: ExternalDefinedRoleContentAndParentTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.contentprovider;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.objectteams.otdt.core.ICallinMapping;
+import org.eclipse.objectteams.otdt.core.ICalloutMapping;
+import org.eclipse.objectteams.otdt.core.IOTJavaElement;
+import org.eclipse.objectteams.otdt.core.IOTType;
+import org.eclipse.objectteams.otdt.core.IRoleType;
+import org.eclipse.objectteams.otdt.core.OTModelManager;
+import org.eclipse.objectteams.otdt.internal.ui.packageview.PackageExplorerAdaptor;
+import org.eclipse.objectteams.otdt.ui.tests.FileBasedUITest;
+import org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider;
+
+/**
+ * @author kaschja
+ * @version $Id: ExternalDefinedRoleContentAndParentTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * This test class contains test methods that test the methods
+ * PackageExplorerContentProvider.getChildren and PackageExplorerContentProvider.getParent
+ * with several external defined role classes as argument
+ */
+@SuppressWarnings("restriction")
+public class ExternalDefinedRoleContentAndParentTests extends FileBasedUITest
+{
+ final int METHOD_IDX = 0;
+ final int MAPPING_IDX = 1;
+
+ private PackageExplorerContentProvider _testObj;
+
+
+ public ExternalDefinedRoleContentAndParentTests(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ if (true)
+ {
+ return new Suite(ExternalDefinedRoleContentAndParentTests.class);
+ }
+ junit.framework.TestSuite suite = new Suite(ExternalDefinedRoleContentAndParentTests.class
+ .getName());
+ return suite;
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir("ExternalDefinedRole");
+
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ _testObj = new PackageExplorerContentProvider(true);
+ setShowTeamPackages(false);
+ }
+
+ private void setShowTeamPackages(boolean show) {
+ PackageExplorerAdaptor adaptor = PackageExplorerAdaptor.getInstance();
+ adaptor.setShowTeamPackages(show, _testObj);
+ }
+
+
+ private IType getJavaType(String projectName, String srcFolderName, String pkgName, String typeName) throws JavaModelException
+ {
+ ICompilationUnit typeUnit = getCompilationUnit(
+ projectName,
+ srcFolderName,
+ pkgName,
+ typeName +".java");
+ IType typeJavaElem = typeUnit.getType(typeName);
+
+ if ((typeJavaElem != null) && (typeJavaElem.exists()))
+ {
+ return typeJavaElem;
+ }
+ return null;
+ }
+
+ private IRoleType getRole(String srcFolderName, String pkgName, String teamName, String roleName) throws JavaModelException
+ {
+ IType teamJavaElem = getJavaType(getTestProjectDir(), srcFolderName, pkgName, teamName);
+ IOTJavaElement teamOTElem = OTModelManager.getOTElement(teamJavaElem);
+ assertNotNull(teamOTElem);
+
+ IOTType teamType = (IOTType) teamOTElem;
+ IType roleJavaElem = teamType.getRoleType(roleName);
+// IType roleJavaElem = teamJavaElem.getType(roleName); // IOTType.getType() does not return role files!
+ if ((roleJavaElem != null) && (roleJavaElem.exists()))
+ {
+ IRoleType roleOTElem = (IRoleType) OTModelManager.getOTElement(roleJavaElem);
+ return roleOTElem;
+ }
+ return null;
+ }
+
+
+ public void testRoleContent_EmptyRole() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_1", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 0);
+ }
+
+ public void testRoleContent_Field() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_2", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IField);
+
+ IField field = (IField) children[0];
+ assertEquals("roleAttr", field.getElementName());
+ assertEquals("QString;", field.getTypeSignature());
+ }
+
+ public void testRoleContent_ParameterlessMethod() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3a", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IMethod);
+
+ IMethod method = (IMethod) children[0];
+ assertEquals("roleMethod", method.getElementName());
+ assertEquals("()V", method.getSignature());
+ }
+
+ public void testRoleContent_MethodWithParameter() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3b", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IMethod);
+
+ IMethod method = (IMethod) children[0];
+ assertEquals("roleMethod", method.getElementName());
+ assertEquals("(QString;)V", method.getSignature());
+ }
+
+ public void testRoleContent_MethodWithReturnValue() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3c", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IMethod);
+
+ IMethod method = (IMethod) children[0];
+ assertEquals("roleMethod", method.getElementName());
+ assertEquals("()QString;", method.getSignature());
+ }
+
+ public void testRoleContent_MethodWithThrowClause() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3d", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IMethod);
+
+ IMethod method = (IMethod) children[0];
+ assertEquals("roleMethod", method.getElementName());
+ assertEquals("()V", method.getSignature());
+
+ String[] exceptionTypes = method.getExceptionTypes();
+ assertNotNull(exceptionTypes);
+ assertTrue(exceptionTypes.length == 1);
+ assertEquals("QException;", exceptionTypes[0]);
+ }
+
+ public void testRoleContent_Innerclass() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4a", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IType);
+
+ IType innerType = (IType) children[0];
+ assertEquals("AnInnerClass", innerType.getElementName());
+ }
+
+ public void testRoleContent_InnerTeamClass() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4b", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IType);
+
+ IType innerType = (IType) children[0];
+ assertEquals("AnInnerTeamClass", innerType.getElementName());
+ }
+
+
+ public void testRoleContent_BoundRoleWithAbstractMethodAndCalloutMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5a", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+ assertNotNull(children);
+ assertTrue(children.length == 2);
+
+ assertTrue(children[MAPPING_IDX] instanceof ICalloutMapping);
+ assertEquals("roleMethod -> baseMethod", ((ICalloutMapping)children[MAPPING_IDX]).getElementName());
+
+ assertTrue(children[METHOD_IDX] instanceof IMethod);
+ IMethod method = (IMethod) children[METHOD_IDX];
+ assertEquals("roleMethod", method.getElementName());
+ assertEquals("()V", method.getSignature());
+ }
+
+ public void testRoleContent_BoundRoleWithConcreteMethodAndCalloutMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5b", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+ assertNotNull(children);
+ assertTrue(children.length == 2);
+
+ assertTrue(children[MAPPING_IDX] instanceof ICalloutMapping);
+ //TODO (kaschja) change mapping name by the time there is a distinction of '->' and '=>' in the OT-Model
+ assertEquals("roleMethod -> baseMethod", ((ICalloutMapping)children[MAPPING_IDX]).getElementName());
+
+ assertTrue(children[METHOD_IDX] instanceof IMethod);
+ IMethod method = (IMethod) children[METHOD_IDX];
+ assertEquals("roleMethod", method.getElementName());
+ assertEquals("()V", method.getSignature());
+ }
+
+ public void testRoleContent_BoundRoleWithMethodAndBeforeCallinMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5c", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+ assertNotNull(children);
+ assertTrue(children.length == 2);
+
+ assertTrue(children[MAPPING_IDX] instanceof ICallinMapping);
+ ICallinMapping mapping = (ICallinMapping)children[MAPPING_IDX];
+ assertEquals("roleMethod <- baseMethod", mapping.getElementName());
+ assertTrue(mapping.getCallinKind() == ICallinMapping.KIND_BEFORE);
+
+ assertTrue(children[METHOD_IDX] instanceof IMethod);
+ IMethod method = (IMethod) children[METHOD_IDX];
+ assertEquals("roleMethod", method.getElementName());
+ assertEquals("()V", method.getSignature());
+ }
+
+ public void testRoleContent_BoundRoleWithMethodAndReplaceCallinMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5d", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+ assertNotNull(children);
+ assertTrue(children.length == 2);
+
+ assertTrue(children[MAPPING_IDX] instanceof ICallinMapping);
+ ICallinMapping mapping = (ICallinMapping)children[MAPPING_IDX];
+ assertEquals("roleMethod <- baseMethod", mapping.getElementName());
+ assertTrue(mapping.getCallinKind() == ICallinMapping.KIND_REPLACE);
+
+ assertTrue(children[METHOD_IDX] instanceof IMethod);
+ IMethod method = (IMethod) children[METHOD_IDX];
+ assertEquals("roleMethod", method.getElementName());
+ assertEquals("()V", method.getSignature());
+ }
+
+ public void testRoleContent_BoundRoleWithMethodAndAfterCallinMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5e", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+ assertNotNull(children);
+ assertTrue(children.length == 2);
+
+ assertTrue(children[MAPPING_IDX] instanceof ICallinMapping);
+ ICallinMapping mapping = (ICallinMapping)children[MAPPING_IDX];
+ assertEquals("roleMethod <- baseMethod", mapping.getElementName());
+ assertTrue(mapping.getCallinKind() == ICallinMapping.KIND_AFTER);
+
+ assertTrue(children[METHOD_IDX] instanceof IMethod);
+ IMethod method = (IMethod) children[METHOD_IDX];
+ assertEquals("roleMethod", method.getElementName());
+ assertEquals("()V", method.getSignature());
+ }
+
+//************************************************************
+// from here: testRoleParent
+//************************************************************
+ public void testRoleParent_EmptyRole() throws JavaModelException
+ {
+ IRoleType roleOTElem = getRole("unbound", "teampkg", "Team_1", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals("Team_1", ((IType)parent).getElementName());
+ }
+
+ public void testRoleParent_EmptyRole_PhysicalView() throws JavaModelException
+ {
+ IRoleType roleOTElem = getRole("unbound", "teampkg", "Team_1", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ setShowTeamPackages(true);
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue("direct parent should be ICompilationUnit", parent instanceof ICompilationUnit);
+ parent = _testObj.getParent(parent);
+ assertTrue("second level parent should be IPackageFragment", parent instanceof IPackageFragment);
+ assertEquals("Team package should have team name", "teampkg.Team_1", ((IPackageFragment)parent).getElementName());
+ }
+
+ public void testRoleParent_RoleWithField() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_2", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals("Team_2", ((IType)parent).getElementName());
+ }
+
+ public void testRoleParent_RoleWithParameterlessMethod() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3a", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals("Team_3a", ((IType)parent).getElementName());
+ }
+
+ public void testRoleParent_RoleWithMethodWithParameter() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3b", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals("Team_3b", ((IType)parent).getElementName());
+ }
+
+ public void testRoleParent_RoleWithMethodWithReturnValue() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3c", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals("Team_3c", ((IType)parent).getElementName());
+ }
+
+ public void testRoleParent_RoleWithMethodWithThrowClause() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3d", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals("Team_3d", ((IType)parent).getElementName());
+ }
+
+ public void testRoleParent_RoleWithInnerclass() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4a", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals("Team_4a", ((IType)parent).getElementName());
+ }
+
+ public void testRoleParent_RoleWithInnerTeamClass() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4b", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals("Team_4b", ((IType)parent).getElementName());
+ }
+
+ public void testRoleParent_BoundRoleWithAbstractMethodAndCalloutMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5a", "SampleRole");
+ assertNotNull(roleOTElem);
+ Object parent = _testObj.getParent(roleOTElem);
+
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals("Team_5a", ((IType)parent).getElementName());
+ }
+
+ public void testRoleParent_BoundRoleWithConcreteMethodAndCalloutMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5b", "SampleRole");
+ assertNotNull(roleOTElem);
+ Object parent = _testObj.getParent(roleOTElem);
+
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals("Team_5b", ((IType)parent).getElementName());
+ }
+
+ public void testRoleParent_BoundRoleWithMethodAndBeforeCallinMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5c", "SampleRole");
+ assertNotNull(roleOTElem);
+ Object parent = _testObj.getParent(roleOTElem);
+
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals("Team_5c", ((IType)parent).getElementName());
+ }
+
+ public void testRoleParent_BoundRoleWithMethodAndReplaceCallinMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5d", "SampleRole");
+ assertNotNull(roleOTElem);
+ Object parent = _testObj.getParent(roleOTElem);
+
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals("Team_5d", ((IType)parent).getElementName());
+ }
+
+ public void testRoleParent_BoundRoleWithMethodAndAfterCallinMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5e", "SampleRole");
+ assertNotNull(roleOTElem);
+ Object parent = _testObj.getParent(roleOTElem);
+
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals("Team_5e", ((IType)parent).getElementName());
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/InternalDefinedRoleContentAndParentTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/InternalDefinedRoleContentAndParentTests.java
new file mode 100644
index 000000000..95bb98dec
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/InternalDefinedRoleContentAndParentTests.java
@@ -0,0 +1,498 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: InternalDefinedRoleContentAndParentTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.contentprovider;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.objectteams.otdt.core.ICallinMapping;
+import org.eclipse.objectteams.otdt.core.ICalloutMapping;
+import org.eclipse.objectteams.otdt.core.IOTJavaElement;
+import org.eclipse.objectteams.otdt.core.OTModelManager;
+import org.eclipse.objectteams.otdt.ui.tests.FileBasedUITest;
+import org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider;
+
+/**
+ * @author kaschja
+ * @version $Id: InternalDefinedRoleContentAndParentTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * This test class contains test methods that test the methods
+ * PackageExplorerContentProvider.getChildren and PackageExplorerContentProvider.getParent
+ * with several internal defined role classes as argument
+ */
+@SuppressWarnings("restriction")
+public class InternalDefinedRoleContentAndParentTests extends FileBasedUITest
+{
+ final int METHOD_IDX = 0;
+ final int MAPPING_IDX = 1;
+
+ private PackageExplorerContentProvider _testObj;
+
+ public InternalDefinedRoleContentAndParentTests(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ if (true)
+ {
+ return new Suite(InternalDefinedRoleContentAndParentTests.class);
+ }
+ junit.framework.TestSuite suite = new Suite(InternalDefinedRoleContentAndParentTests.class
+ .getName());
+ return suite;
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir("InternalDefinedRole");
+
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ _testObj = new PackageExplorerContentProvider(true);
+ }
+
+
+ private IType getJavaType(String projectName, String srcFolderName, String pkgName, String typeName) throws JavaModelException
+ {
+ ICompilationUnit typeUnit = getCompilationUnit(
+ projectName,
+ srcFolderName,
+ pkgName,
+ typeName +".java");
+ IType typeJavaElem = typeUnit.getType(typeName);
+
+ if ((typeJavaElem != null) && (typeJavaElem.exists()))
+ {
+ return typeJavaElem;
+ }
+ return null;
+ }
+
+ private IOTJavaElement getRole(String srcFolderName, String pkgName, String teamName, String roleName) throws JavaModelException
+ {
+ IType teamJavaElem = getJavaType(getTestProjectDir(), srcFolderName, pkgName, teamName);
+
+ if (teamJavaElem != null)
+ {
+ IType roleJavaElem = teamJavaElem.getType(roleName);
+ if ((roleJavaElem != null) && (roleJavaElem.exists()))
+ {
+ IOTJavaElement roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ if (roleOTElem != null)
+ {
+ return roleOTElem;
+ }
+ }
+ }
+ return null;
+ }
+
+
+ public void testRoleContent_EmptyRole() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_1", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 0);
+ }
+
+ public void testRoleContent_Field() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_2", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IField);
+
+ IField field = (IField) children[0];
+ assertEquals(field.getElementName(), "roleAttr");
+ assertEquals(field.getTypeSignature(), "QString;");
+ }
+
+ public void testRoleContent_ParameterlessMethod() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3a", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IMethod);
+
+ IMethod method = (IMethod) children[0];
+ assertEquals(method.getElementName(), "roleMethod");
+ assertEquals(method.getSignature(), "()V");
+ }
+
+ public void testRoleContent_MethodWithParameter() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3b", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IMethod);
+
+ IMethod method = (IMethod) children[0];
+ assertEquals(method.getElementName(), "roleMethod");
+ assertEquals(method.getSignature(), "(QString;)V");
+ }
+
+ public void testRoleContent_MethodWithReturnValue() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3c", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IMethod);
+
+ IMethod method = (IMethod) children[0];
+ assertEquals(method.getElementName(), "roleMethod");
+ assertEquals(method.getSignature(), "()QString;");
+ }
+
+ public void testRoleContent_MethodWithThrowClause() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3d", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IMethod);
+
+ IMethod method = (IMethod) children[0];
+ assertEquals(method.getElementName(), "roleMethod");
+ assertEquals(method.getSignature(), "()V");
+
+ String[] exceptionTypes = method.getExceptionTypes();
+ assertNotNull(exceptionTypes);
+ assertTrue(exceptionTypes.length == 1);
+ assertEquals(exceptionTypes[0], "QException;");
+ }
+
+ public void testRoleContent_Innerclass() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4a", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IType);
+
+ IType innerType = (IType) children[0];
+ assertEquals(innerType.getElementName(), "AnInnerClass");
+ }
+
+ public void testRoleContent_InnerTeamClass() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4b", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IType);
+
+ IType innerType = (IType) children[0];
+ assertEquals(innerType.getElementName(), "AnInnerTeamClass");
+ }
+
+
+ public void testRoleContent_BoundRoleWithAbstractMethodAndCalloutMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5a", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+ assertNotNull(children);
+
+ //*********
+// Logger.println(children.length);
+// for (int idx = 0; idx < children.length; idx++)
+// {
+// Logger.println(children[idx].toString());
+// }
+ assertTrue(children.length == 2);
+ //*********
+
+ assertTrue(children[MAPPING_IDX] instanceof ICalloutMapping);
+ assertEquals("roleMethod -> baseMethod", ((ICalloutMapping)children[MAPPING_IDX]).getElementName());
+
+ assertTrue(children[METHOD_IDX] instanceof IMethod);
+ IMethod method = (IMethod) children[METHOD_IDX];
+ assertEquals(method.getElementName(), "roleMethod");
+ assertEquals(method.getSignature(), "()V");
+ }
+
+ public void testRoleContent_BoundRoleWithConcreteMethodAndCalloutMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5b", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+ assertNotNull(children);
+ assertTrue(children.length == 2);
+
+ assertTrue(children[MAPPING_IDX] instanceof ICalloutMapping);
+ //TODO (kaschja) change mapping name by the time there is a distinction of '->' and '=>' in the OT-Model
+ assertEquals("roleMethod -> baseMethod", ((ICalloutMapping)children[MAPPING_IDX]).getElementName());
+
+ assertTrue(children[METHOD_IDX] instanceof IMethod);
+ IMethod method = (IMethod) children[METHOD_IDX];
+ assertEquals(method.getElementName(), "roleMethod");
+ assertEquals(method.getSignature(), "()V");
+ }
+
+ public void testRoleContent_BoundRoleWithMethodAndBeforeCallinMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5c", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+ assertNotNull(children);
+ assertTrue(children.length == 2);
+
+ assertTrue(children[MAPPING_IDX] instanceof ICallinMapping);
+ ICallinMapping mapping = (ICallinMapping)children[MAPPING_IDX];
+ assertEquals("roleMethod <- baseMethod", mapping.getElementName());
+ assertTrue(mapping.getCallinKind() == ICallinMapping.KIND_BEFORE);
+
+ assertTrue(children[METHOD_IDX] instanceof IMethod);
+ IMethod method = (IMethod) children[METHOD_IDX];
+ assertEquals(method.getElementName(), "roleMethod");
+ assertEquals(method.getSignature(), "()V");
+ }
+
+ public void testRoleContent_BoundRoleWithMethodAndReplaceCallinMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5d", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+ assertNotNull(children);
+ assertTrue(children.length == 2);
+
+ assertTrue(children[MAPPING_IDX] instanceof ICallinMapping);
+ ICallinMapping mapping = (ICallinMapping)children[MAPPING_IDX];
+ assertEquals("roleMethod <- baseMethod", mapping.getElementName());
+ assertTrue(mapping.getCallinKind() == ICallinMapping.KIND_REPLACE);
+
+ assertTrue(children[METHOD_IDX] instanceof IMethod);
+ IMethod method = (IMethod) children[METHOD_IDX];
+ assertEquals(method.getElementName(), "roleMethod");
+ assertEquals(method.getSignature(), "()V");
+ }
+
+ public void testRoleContent_BoundRoleWithMethodAndAfterCallinMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5e", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object[] children = _testObj.getChildren(roleOTElem);
+ assertNotNull(children);
+ assertTrue(children.length == 2);
+
+ assertTrue(children[MAPPING_IDX] instanceof ICallinMapping);
+ ICallinMapping mapping = (ICallinMapping)children[MAPPING_IDX];
+ assertEquals("roleMethod <- baseMethod", mapping.getElementName());
+ assertTrue(mapping.getCallinKind() == ICallinMapping.KIND_AFTER);
+
+ assertTrue(children[METHOD_IDX] instanceof IMethod);
+ IMethod method = (IMethod) children[METHOD_IDX];
+ assertEquals(method.getElementName(), "roleMethod");
+ assertEquals(method.getSignature(), "()V");
+ }
+
+//************************************************************
+// from here: testRoleParent
+//************************************************************
+ public void testRoleParent_EmptyRole() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_1", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals(((IType)parent).getElementName(), "Team_1");
+ }
+
+ public void testRoleParent_RoleWithField() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_2", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals(((IType)parent).getElementName(), "Team_2");
+ }
+
+ public void testRoleParent_RoleWithParameterlessMethod() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3a", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals(((IType)parent).getElementName(), "Team_3a");
+ }
+
+ public void testRoleParent_RoleWithMethodWithParameter() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3b", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals(((IType)parent).getElementName(), "Team_3b");
+ }
+
+ public void testRoleParent_RoleWithMethodWithReturnValue() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3c", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals(((IType)parent).getElementName(), "Team_3c");
+ }
+
+ public void testRoleParent_RoleWithMethodWithThrowClause() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_3d", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals(((IType)parent).getElementName(), "Team_3d");
+ }
+
+ public void testRoleParent_RoleWithInnerclass() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4a", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals(((IType)parent).getElementName(), "Team_4a");
+ }
+
+ public void testRoleParent_RoleWithInnerTeamClass() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("unbound", "teampkg", "Team_4b", "SampleRole");
+ assertNotNull(roleOTElem);
+
+ Object parent = _testObj.getParent(roleOTElem);
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals(((IType)parent).getElementName(), "Team_4b");
+ }
+
+ public void testRoleParent_BoundRoleWithAbstractMethodAndCalloutMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5a", "SampleRole");
+ assertNotNull(roleOTElem);
+ Object parent = _testObj.getParent(roleOTElem);
+
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals(((IType)parent).getElementName(), "Team_5a");
+ }
+
+ public void testRoleParent_BoundRoleWithConcreteMethodAndCalloutMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5b", "SampleRole");
+ assertNotNull(roleOTElem);
+ Object parent = _testObj.getParent(roleOTElem);
+
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals(((IType)parent).getElementName(), "Team_5b");
+ }
+
+ public void testRoleParent_BoundRoleWithMethodAndBeforeCallinMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5c", "SampleRole");
+ assertNotNull(roleOTElem);
+ Object parent = _testObj.getParent(roleOTElem);
+
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals(((IType)parent).getElementName(), "Team_5c");
+ }
+
+ public void testRoleParent_BoundRoleWithMethodAndReplaceCallinMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5d", "SampleRole");
+ assertNotNull(roleOTElem);
+ Object parent = _testObj.getParent(roleOTElem);
+
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals(((IType)parent).getElementName(), "Team_5d");
+ }
+
+ public void testRoleParent_BoundRoleWithMethodAndAfterCallinMapping() throws JavaModelException
+ {
+ IOTJavaElement roleOTElem = getRole("boundtoordinary", "teampkg", "Team_5e", "SampleRole");
+ assertNotNull(roleOTElem);
+ Object parent = _testObj.getParent(roleOTElem);
+
+ assertNotNull(parent);
+ assertTrue(parent instanceof IType);
+ assertEquals(((IType)parent).getElementName(), "Team_5e");
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/Logger.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/Logger.java
new file mode 100644
index 000000000..49103a3e9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/Logger.java
@@ -0,0 +1,50 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: Logger.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.contentprovider;
+
+/**
+ * @author kaschja
+ * @version $Id: Logger.java 23495 2010-02-05 23:15:16Z stephan $
+ */
+public class Logger
+{
+ public static void println(Object obj)
+ {
+ if (obj instanceof String)
+ {
+ System.out.println(obj);
+ }
+ else
+ {
+ System.out.println(obj.toString());
+ }
+ }
+
+// public static void println(String text)
+// {
+// System.out.println(text);
+// }
+
+ public static void println(int number)
+ {
+ System.out.println(number);
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/TeamContentTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/TeamContentTests.java
new file mode 100644
index 000000000..04209754e
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/contentprovider/TeamContentTests.java
@@ -0,0 +1,291 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: TeamContentTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.contentprovider;
+
+import junit.framework.Test;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.objectteams.otdt.core.IOTJavaElement;
+import org.eclipse.objectteams.otdt.core.IRoleType;
+import org.eclipse.objectteams.otdt.core.OTModelManager;
+import org.eclipse.objectteams.otdt.ui.tests.FileBasedUITest;
+import org.eclipse.jdt.internal.ui.packageview.PackageExplorerContentProvider;
+
+/**
+ * @author kaschja
+ * @version $Id: TeamContentTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * This test class contains test methods that test the method
+ * PackageExplorerContentProvider.getChildren
+ * with several team classes as argument
+ */
+@SuppressWarnings("restriction")
+public class TeamContentTests extends FileBasedUITest
+{
+
+ private PackageExplorerContentProvider _testObj;
+
+
+ public TeamContentTests(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ if (true)
+ {
+ return new Suite(TeamContentTests.class);
+ }
+ junit.framework.TestSuite suite = new Suite(TeamContentTests.class
+ .getName());
+ return suite;
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir("TeamProject");
+
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ _testObj = new PackageExplorerContentProvider(true);
+ }
+
+
+ private IType getJavaType(String projectName, String srcFolderName, String pkgName, String typeName) throws JavaModelException
+ {
+ ICompilationUnit typeUnit = getCompilationUnit(
+ projectName,
+ srcFolderName,
+ pkgName,
+ typeName +".java");
+ IType typeJavaElem = typeUnit.getType(typeName);
+
+ if ((typeJavaElem != null) && (typeJavaElem.exists()))
+ {
+ return typeJavaElem;
+ }
+ return null;
+ }
+
+ private IOTJavaElement getTeam(String srcFolderName, String pkgName, String teamName) throws JavaModelException
+ {
+ IType teamJavaElem = getJavaType(getTestProjectDir(), srcFolderName, pkgName, teamName);
+
+ if (teamJavaElem != null)
+ {
+ IOTJavaElement teamOTElem = OTModelManager.getOTElement(teamJavaElem);
+ if (teamOTElem != null)
+ {
+ return teamOTElem;
+ }
+ }
+ return null;
+ }
+
+
+ public void testTeamContent_EmptyTeam() throws JavaModelException
+ {
+ IOTJavaElement teamOTElem = getTeam("src", "teampkg", "EmptyTeam");
+ assertNotNull(teamOTElem);
+
+ Object[] children = _testObj.getChildren(teamOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 0);
+ }
+
+ public void testTeamContent_Field() throws JavaModelException
+ {
+ IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithField");
+ assertNotNull(teamOTElem);
+
+ Object[] children = _testObj.getChildren(teamOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IField);
+
+ IField field = (IField) children[0];
+ assertEquals(field.getElementName(), "teamlevelField");
+ assertEquals(field.getTypeSignature(), "QString;");
+ }
+
+ public void testTeamContent_ParameterlessMethod() throws JavaModelException
+ {
+ IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithParameterlessMethod");
+ assertNotNull(teamOTElem);
+
+ Object[] children = _testObj.getChildren(teamOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IMethod);
+
+ IMethod method = (IMethod) children[0];
+ assertEquals(method.getElementName(), "teamlevelMethod");
+ assertEquals(method.getSignature(), "()V");
+ }
+
+ public void testTeamContent_MethodWithParameter() throws JavaModelException
+ {
+ IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithMethodWithParameter");
+ assertNotNull(teamOTElem);
+
+ Object[] children = _testObj.getChildren(teamOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IMethod);
+
+ IMethod method = (IMethod) children[0];
+ assertEquals(method.getElementName(), "teamlevelMethod");
+ assertEquals(method.getSignature(), "(QString;)V");
+ }
+
+ public void testTeamContent_MethodWithReturnValue() throws JavaModelException
+ {
+ IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithMethodWithReturnValue");
+ assertNotNull(teamOTElem);
+
+ Object[] children = _testObj.getChildren(teamOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IMethod);
+
+ IMethod method = (IMethod) children[0];
+ assertEquals(method.getElementName(), "teamlevelMethod");
+ assertEquals(method.getSignature(), "()QString;");
+ }
+
+ public void testTeamContent_MethodWithThrowClause() throws JavaModelException
+ {
+ IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithMethodWithThrowClause");
+ assertNotNull(teamOTElem);
+
+ Object[] children = _testObj.getChildren(teamOTElem);
+
+ assertNotNull(children);
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IMethod);
+
+ IMethod method = (IMethod) children[0];
+ assertEquals(method.getElementName(), "teamlevelMethod");
+ assertEquals(method.getSignature(), "()V");
+
+ String[] exceptionTypes = method.getExceptionTypes();
+ assertNotNull(exceptionTypes);
+ assertTrue(exceptionTypes.length == 1);
+ assertEquals(exceptionTypes[0], "QException;");
+ }
+
+ public void testTeamContent_InnerRoleClass() throws JavaModelException
+ {
+ IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithRoleClass");
+ assertNotNull(teamOTElem);
+
+ Object[] children = _testObj.getChildren(teamOTElem);
+
+ assertNotNull(children);
+
+// Logger.println(children.length);
+// Logger.println(((IRoleType)children[0]).getElementName());
+
+ assertTrue(children.length == 1);
+
+ assertTrue(children[0] instanceof IRoleType);
+
+ IRoleType innerType = (IRoleType) children[0];
+ assertEquals(innerType.getElementName(), "RoleClass");
+ }
+
+ public void testTeamContent_InnerTeamClass() throws JavaModelException
+ {
+ IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithInnerTeamClass");
+ assertNotNull(teamOTElem);
+
+ Object[] children = _testObj.getChildren(teamOTElem);
+
+ assertNotNull(children);
+
+// Logger.println(children.length);
+// Logger.println(((IRoleType)children[0]).getElementName());
+
+ assertTrue(children.length == 1);
+ assertTrue(children[0] instanceof IRoleType);
+
+ IRoleType innerType = (IRoleType) children[0];
+ assertEquals(innerType.getElementName(), "InnerTeamClass");
+ //TODO (kaschja) comment in next line by the time team cascading is supported
+ //assertTrue(innerType.isTeam());
+ }
+
+//TODO (kaschja) test containment of external defined role classes in a team depending on user defined visibility specification for external role packages
+// public void testTeamContent_ExternalDefinedRoleClass() throws JavaModelException
+// {
+// PackageExplorerPart part = new PackageExplorerPart();
+// part.createPartControl(null);
+//
+// PackageExplorerContentProvider contentProviderToTest = part.getContentProvider();
+// HideExternalRolePackagesAction hideRolesAction = contentProviderToTest.getHideRolesAction();
+// IOTJavaElement teamOTElem = getTeam("src", "teampkg", "TeamWithExternalDefinedRoleClass");
+// Object[] children;
+//
+// assertNotNull(contentProviderToTest);
+// assertNotNull(hideRolesAction);
+// assertNotNull(teamOTElem);
+//
+//
+// if (!hideRolesAction.isRolePackageVisible())
+// {
+// //switch the state to "role package is visible"
+// _hideExternalRolesAction.run();
+// }
+// assertTrue(hideRolesAction.isRolePackageVisible());
+//
+// children = contentProviderToTest.getChildren(teamOTElem);
+//
+// assertNotNull(children);
+// assertTrue(children.length == 1);
+// assertTrue(children[0] instanceof IRoleType);
+//
+// IRoleType innerType = (IRoleType) children[0];
+// assertEquals(innerType.getElementName(), "RoleClass");
+//
+//
+// //switch the state to "role package is NOT visible"
+// hideRolesAction.run();
+// assertTrue(!hideRolesAction.isRolePackageVisible());
+//
+// children = contentProviderToTest.getChildren(teamOTElem);
+// assertNotNull(children);
+// assertTrue(children.length == 0);
+// }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddImportQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddImportQuickFixTest.java
new file mode 100644
index 000000000..671140a29
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddImportQuickFixTest.java
@@ -0,0 +1,388 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: AddImportQuickFixTest.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.core;
+
+import java.util.ArrayList;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IImportDeclaration;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
+import org.eclipse.jdt.internal.ui.text.correction.proposals.CUCorrectionProposal;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jdt.ui.tests.core.ProjectTestSetup;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.internal.Workbench;
+
+public class AddImportQuickFixTest extends OTQuickFixTest {
+
+
+ private static final Class THIS= AddImportQuickFixTest.class;
+
+
+ public AddImportQuickFixTest(String name) {
+ super(name);
+ }
+
+ public static Test allTests() {
+ return setUpTest(new TestSuite(THIS));
+ }
+
+ public static Test setUpTest(Test test) {
+ return new ProjectTestSetup(test);
+ }
+
+ public static Test suite() {
+ return allTests();
+ }
+
+ public void testChangeFQNToBaseImport1() throws Exception {
+ // base:
+ IPackageFragment pack1base= fSourceFolder.createPackageFragment("test.base1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf = new StringBuffer();
+ buf.append("package test.base1;\n");
+ buf.append("public class Base1 {\n");
+ buf.append("}\n");
+ pack1base.createCompilationUnit("Base1.java", buf.toString(), false, null);
+
+ // team:
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test.import1", false, null);
+ buf = new StringBuffer();
+ buf.append("package test.import1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R2 playedBy test.base1.Base1 {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 2);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= null;
+ for (Object prop : proposals)
+ if (((CUCorrectionProposal)prop).getRelevance() > 0)
+ proposal = (CUCorrectionProposal)prop;
+ assertNotNull("Need proposal with positive relevance", proposal);
+ assertEquals("Wrong quickfix label", "\"Change qualified reference to using 'import base test...Base1;'\"", proposal.getDisplayString());
+
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test.import1;\n");
+ buf.append("\n");
+ buf.append("import base test.base1.Base1;\n");
+ buf.append("\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R2 playedBy Base1 {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ // ROFI variant:
+ public void testChangeFQNToBaseImport2() throws Exception {
+ // base:
+ IPackageFragment pack1base= fSourceFolder.createPackageFragment("test.base1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf = new StringBuffer();
+ buf.append("package test.base1;\n");
+ buf.append("public class Base1 {\n");
+ buf.append("}\n");
+ pack1base.createCompilationUnit("Base1.java", buf.toString(), false, null);
+
+ // team:
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test.import1", false, null);
+ buf = new StringBuffer();
+ buf.append("package test.import1;\n");
+ buf.append("public team class T {\n");
+ buf.append("}\n");
+ ICompilationUnit teamUnit = pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+ // ROFI:
+ IPackageFragment teamPack = fSourceFolder.createPackageFragment("test.import1.T", true, null);
+ buf = new StringBuffer();
+ buf.append("team package test.import1.T;\n");
+ buf.append("protected class R2 playedBy test.base1.Base1 {\n");
+ buf.append("}\n");
+ ICompilationUnit cu= teamPack.createCompilationUnit("R2.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 2);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= null;
+ for (Object prop : proposals)
+ if (((CUCorrectionProposal)prop).getRelevance() > 0)
+ proposal = (CUCorrectionProposal)prop;
+ assertNotNull("Need proposal with positive relevance", proposal);
+ assertEquals("Wrong quickfix label", "\"Change qualified reference to using 'import base test...Base1;'\"", proposal.getDisplayString());
+
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("team package test.import1.T;\n");
+ buf.append("protected class R2 playedBy Base1 {\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+
+ // fetch and analyze team content which is not covered by the preview:
+ IEditorPart part= JavaUI.openInEditor(teamUnit);
+ assertNotNull("Failed to open team unit in editor", part);
+ IDocument document = JavaUI.getDocumentProvider().getDocument(part.getEditorInput());
+ proposal.apply(document);
+ // not needed: teamUnit.makeConsistent(null);
+ IImportDeclaration[] imports = teamUnit.getImports();
+ assertNotNull("Expected an import", imports);
+ assertEquals("Expected one import", 1, imports.length);
+ assertEquals("Unexpected import", "test.base1.Base1", imports[0].getElementName());
+ assertEquals("Expected base import", ExtraCompilerModifiers.AccBase, imports[0].getFlags());
+
+ // drop editors whose content has been modified by apply(),
+ // so that tearDown can delete files without asking the user:
+ Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);
+ }
+
+ /* Adding a base import to a team on behalf of a role file. */
+ public void testAddBaseImportForRofi1() throws Exception {
+ // base:
+ IPackageFragment pack1base= fSourceFolder.createPackageFragment("test.base", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf = new StringBuffer();
+ buf.append("package test.base;\n");
+ buf.append("protected class Base1 {\n");
+ buf.append("}\n");
+ pack1base.createCompilationUnit("Base1.java", buf.toString(), false, null);
+
+ // team:
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test.import1", false, null);
+ buf = new StringBuffer();
+ buf.append("package test.import1;\n");
+ buf.append("public team class T {\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+ // role:
+ IPackageFragment pack1T= fSourceFolder.createPackageFragment("test.import1.T", false, null);
+ buf = new StringBuffer();
+ buf.append("team package test.import1.T;\n");
+ buf.append("protected class R2 playedBy Base1 {\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1T.createCompilationUnit("R2.java", buf.toString(), false, null);
+
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 6);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test.import1;\n");
+ buf.append("\n");
+ buf.append("import base test.base.Base1;\n");
+ buf.append("\n");
+ buf.append("public team class T {\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ // this time files already have content
+ public void testAddBaseImportForRofi2() throws Exception {
+ StringBuffer buf;
+ // base:
+ IPackageFragment pack1base= fSourceFolder.createPackageFragment("test.base", false, null);
+ buf = new StringBuffer();
+ buf.append("package test.base;\n");
+ buf.append("protected class Base1 {\n");
+ buf.append("}\n");
+ pack1base.createCompilationUnit("Base1.java", buf.toString(), false, null);
+
+ // team:
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test.import1", false, null);
+ buf = new StringBuffer();
+ buf.append("package test.import1;\n");
+ buf.append("\n");
+ buf.append("import java.util.List;\n");
+ buf.append("\n");
+ buf.append("import base java.awt.Window;\n");
+ buf.append("\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R playedBy Window;\n");
+ buf.append(" \n");
+ buf.append(" List l;\n");
+ buf.append(" \n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+ // role:
+ IPackageFragment pack1T= fSourceFolder.createPackageFragment("test.import1.T", false, null);
+ buf = new StringBuffer();
+ buf.append("team package test.import1.T;\n");
+ buf.append("protected class R2 playedBy Base1 {\n");
+ buf.append(" void foo() {}\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1T.createCompilationUnit("R2.java", buf.toString(), false, null);
+
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 6);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test.import1;\n");
+ buf.append("\n");
+ buf.append("import java.util.List;\n");
+ buf.append("\n");
+ buf.append("import base java.awt.Window;\n");
+ buf.append("\n");
+ buf.append("import base test.base.Base1;\n");
+ buf.append("\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R playedBy Window;\n");
+ buf.append(" \n");
+ buf.append(" List l;\n");
+ buf.append(" \n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ // for role types rather than proposing an import change type to anchored:
+ public void testChangeTypeToAnchored1() throws CoreException {
+ StringBuffer buf;
+ // team:
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test.import1", false, null);
+ buf = new StringBuffer();
+ buf.append("package test.import1;\n");
+ buf.append("\n");
+ buf.append("public team class T {\n");
+ buf.append(" public class R {}\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+ // client
+ IPackageFragment pack2= fSourceFolder.createPackageFragment("test.import2", false, null);
+ buf = new StringBuffer();
+ buf.append("package test.import2;\n");
+ buf.append("\n");
+ buf.append("import test.import1.T;\n");
+ buf.append("\n");
+ buf.append("public class C {\n");
+ buf.append(" final T t = new T();\n");
+ buf.append(" void test() {\n");
+ buf.append(" R r = t.new R();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu = pack2.createCompilationUnit("C.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 7);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test.import2;\n");
+ buf.append("\n");
+ buf.append("import test.import1.T;\n");
+ buf.append("\n");
+ buf.append("public class C {\n");
+ buf.append(" final T t = new T();\n");
+ buf.append(" void test() {\n");
+ buf.append(" R<@t> r = t.new R();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ // for role types rather than proposing an import change type to anchored (role file):
+ public void testChangeTypeToAnchored2() throws CoreException {
+ StringBuffer buf;
+ // team:
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test.import1", false, null);
+ buf = new StringBuffer();
+ buf.append("package test.import1;\n");
+ buf.append("\n");
+ buf.append("/** @role R */\n");
+ buf.append("public team class T {\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+ IPackageFragment teampack= fSourceFolder.createPackageFragment("test.import1.T", false, null);
+ buf = new StringBuffer();
+ buf.append("team package test.import1.T;\n");
+ buf.append("\n");
+ buf.append("public class R {}\n");
+ teampack.createCompilationUnit("R.java", buf.toString(), false, null);
+
+ // client
+ IPackageFragment pack2= fSourceFolder.createPackageFragment("test.import2", false, null);
+ buf = new StringBuffer();
+ buf.append("package test.import2;\n");
+ buf.append("\n");
+ buf.append("import test.import1.T;\n");
+ buf.append("\n");
+ buf.append("public class C {\n");
+ buf.append(" final T t = new T();\n");
+ buf.append(" void test() {\n");
+ buf.append(" R r = t.new R();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu = pack2.createCompilationUnit("C.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 7);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test.import2;\n");
+ buf.append("\n");
+ buf.append("import test.import1.T;\n");
+ buf.append("\n");
+ buf.append("public class C {\n");
+ buf.append(" final T t = new T();\n");
+ buf.append(" void test() {\n");
+ buf.append(" R<@t> r = t.new R();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddUnimplementedMethodsTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddUnimplementedMethodsTest.java
new file mode 100644
index 000000000..4e79302b1
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/AddUnimplementedMethodsTest.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.core;
+
+import java.util.Hashtable;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IImportDeclaration;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.IMethodBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
+import org.eclipse.jdt.internal.corext.codemanipulation.AddUnimplementedMethodsOperation;
+import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
+import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2;
+import org.eclipse.jdt.internal.corext.dom.ASTNodes;
+import org.eclipse.jdt.core.dom.NodeFinder;
+import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser;
+import org.eclipse.jdt.internal.corext.template.java.CodeTemplateContextType;
+import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
+import org.eclipse.jdt.testplugin.JavaProjectHelper;
+import org.eclipse.jdt.testplugin.TestOptions;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jdt.ui.PreferenceConstants;
+import org.eclipse.jdt.ui.tests.core.ProjectTestSetup;
+
+/** Structure is OT_COPY_PASTE from {@link org.eclipse.jdt.ui.tests.core.source.AddUnimplementedMethodsTest}
+ * @since 1.2.1
+ */
+public class AddUnimplementedMethodsTest extends TestCase {
+
+ private static final Class THIS= AddUnimplementedMethodsTest.class;
+
+ private IJavaProject fJavaProject;
+ private IPackageFragment fPackage;
+
+ public AddUnimplementedMethodsTest(String name) {
+ super(name);
+ }
+
+ public static Test allTests() {
+ return new ProjectTestSetup(new TestSuite(THIS));
+ }
+
+ public static Test suite() {
+ if (true) {
+ return allTests();
+ } else {
+ TestSuite suite= new TestSuite();
+ suite.addTest(new AddUnimplementedMethodsTest("test1"));
+ return new ProjectTestSetup(suite);
+ }
+ }
+
+ protected void setUp() throws Exception {
+ fJavaProject= JavaProjectHelper.createJavaProject("DummyProject", "bin");
+ assertNotNull(JavaProjectHelper.addRTJar(fJavaProject));
+
+ Hashtable options= TestOptions.getDefaultOptions();
+ options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
+ options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, "999");
+ fJavaProject.setOptions(options);
+
+ StubUtility.setCodeTemplate(CodeTemplateContextType.METHODSTUB_ID, "${body_statement}\n// TODO", null);
+
+ IPackageFragmentRoot root= JavaProjectHelper.addSourceContainer(fJavaProject, "src");
+ fPackage= root.createPackageFragment("org.eclispe.objectteams.util", true, null);
+
+ IEclipsePreferences node= new ProjectScope(fJavaProject.getProject()).getNode(JavaUI.ID_PLUGIN);
+ node.putBoolean(PreferenceConstants.CODEGEN_USE_OVERRIDE_ANNOTATION, false);
+ node.putBoolean(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
+ node.flush();
+ }
+
+
+ protected void tearDown () throws Exception {
+ JavaProjectHelper.delete(fJavaProject);
+ fJavaProject= null;
+ fPackage= null;
+ }
+
+ public void testTrac143() throws Exception {
+ StringBuffer buf= new StringBuffer();
+ buf.append("package org.eclipse.objectteams.util;\n");
+ buf.append("import java.util.Properties;\n");
+ buf.append("public team class F {\n");
+ buf.append(" public class R {\n");
+ buf.append(" public abstract void b(Properties p);\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ fPackage.createCompilationUnit("F.java", buf.toString(), false, null);
+
+ buf= new StringBuffer();
+ buf.append("package org.eclipse.objectteams.util;\n");
+ ICompilationUnit cu= fPackage.createCompilationUnit("F2.java", buf.toString(), false, null);
+
+ IType testClass= cu.createType("public team class F2 extends F {\n\n}\n", null, true, null);
+ testClass = testClass.createType("public class R playedBy Object {\n\n}\n", null, true, null);
+
+ testHelper(testClass);
+
+ IMethod[] methods= testClass.getMethods();
+ checkMethods(new String[] { "b", "equals", "clone", "toString", "finalize", "hashCode" }, methods);
+
+ IImportDeclaration[] imports= cu.getImports();
+ checkImports(new String[]{"java.util.Properties"}, imports);
+ }
+
+
+ private void testHelper(IType testClass) throws JavaModelException, CoreException {
+ testHelper(testClass, -1, true);
+ }
+
+ private void testHelper(IType testClass, int insertionPos, boolean implementAllOverridable) throws JavaModelException, CoreException {
+ RefactoringASTParser parser= new RefactoringASTParser(AST.JLS3);
+ CompilationUnit unit= parser.parse(testClass.getCompilationUnit(), true);
+ AbstractTypeDeclaration declaration= (AbstractTypeDeclaration) ASTNodes.getParent(NodeFinder.perform(unit, testClass.getNameRange()), AbstractTypeDeclaration.class);
+ assertNotNull("Could not find type declaration node", declaration);
+ ITypeBinding binding= declaration.resolveBinding();
+ assertNotNull("Binding for type declaration could not be resolved", binding);
+
+ IMethodBinding[] overridableMethods= implementAllOverridable ? StubUtility2.getOverridableMethods(unit.getAST(), binding, false) : null;
+
+ AddUnimplementedMethodsOperation op= new AddUnimplementedMethodsOperation(unit, binding, overridableMethods, insertionPos, true, true, true);
+ op.run(new NullProgressMonitor());
+ JavaModelUtil.reconcile(testClass.getCompilationUnit());
+ }
+
+ private void checkMethods(String[] expected, IMethod[] methods) {
+ int nMethods= methods.length;
+ int nExpected= expected.length;
+ assertTrue("" + nExpected + " methods expected, is " + nMethods, nMethods == nExpected);
+ for (int i= 0; i < nExpected; i++) {
+ String methName= expected[i];
+ assertTrue("method " + methName + " expected", nameContained(methName, methods));
+ }
+ }
+
+ private void checkImports(String[] expected, IImportDeclaration[] imports) {
+ int nImports= imports.length;
+ int nExpected= expected.length;
+ if (nExpected != nImports) {
+ StringBuffer buf= new StringBuffer();
+ buf.append(nExpected).append(" imports expected, is ").append(nImports).append("\n");
+ buf.append("expected:\n");
+ for (int i= 0; i < expected.length; i++) {
+ buf.append(expected[i]).append("\n");
+ }
+ buf.append("actual:\n");
+ for (int i= 0; i < imports.length; i++) {
+ buf.append(imports[i]).append("\n");
+ }
+ assertTrue(buf.toString(), false);
+ }
+ for (int i= 0; i < nExpected; i++) {
+ String impName= expected[i];
+ assertTrue("import " + impName + " expected", nameContained(impName, imports));
+ }
+ }
+
+ private boolean nameContained(String methName, IJavaElement[] methods) {
+ for (int i= 0; i < methods.length; i++) {
+ if (methods[i].getElementName().equals(methName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CallinQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CallinQuickFixTest.java
new file mode 100644
index 000000000..003cd38b5
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CallinQuickFixTest.java
@@ -0,0 +1,177 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: CallinQuickFixTest.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.core;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.objectteams.otdt.core.ext.OTDTPlugin;
+
+/**
+ * Test OT-specific quickfixes (here: callin related issues).
+ * @author stephan
+ * @since 1.2.8
+ */
+public class CallinQuickFixTest extends OTQuickFixTest {
+
+ private static final Class THIS= CallinQuickFixTest.class;
+
+ public CallinQuickFixTest(String name) {
+ super(name);
+ }
+
+ public static Test allTests() {
+ return setUpTest(new TestSuite(THIS));
+ }
+
+ public static Test setUpTest(Test test) {
+ return new ProjectTestSetup(test);
+ }
+
+ public static Test suite() {
+ return allTests();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void addOptions(Hashtable options) {
+ super.addOptions(options);
+ // need to configure 5.4(c) to warning to enable quickfix for testSuppressWarning1():
+ options.put(OTDTPlugin.OT_COMPILER_EXCEPTION_IN_GUARD, JavaCore.WARNING);
+ }
+
+ /* Suppressing a warning re exception thrown from guard predicate. */
+ public void testSuppressWarning1() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class B1 {\n");
+ buf.append(" public void foo() {};\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" void foo(){\n");
+ buf.append(" System.out.print(\"OK\");\n");
+ buf.append(" }\n");
+ buf.append(" boolean bad() throws Exception {\n");
+ buf.append(" throw new Exception(\"too bad\");\n");
+ buf.append(" }\n");
+ buf.append(" foo <- after foo when (bad());\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cuteam);
+ ArrayList proposals= collectCorrections(cuteam, astRoot);
+ assertNumberOfProposals(proposals, 1);
+ assertCorrectLabels(proposals);
+
+ String[] expectedProposals = new String[1];
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" void foo(){\n");
+ buf.append(" System.out.print(\"OK\");\n");
+ buf.append(" }\n");
+ buf.append(" boolean bad() throws Exception {\n");
+ buf.append(" throw new Exception(\"too bad\");\n");
+ buf.append(" }\n");
+ buf.append(" @SuppressWarnings(\"exceptioninguard\")\n");
+ buf.append(" foo <- after foo when (bad());\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ expectedProposals[0] = buf.toString();
+
+
+ assertExpectedExistInProposals(proposals, expectedProposals);
+ }
+
+ /* Adjust a callin modifier to the bound role method (after -> replace). */
+ public void testChangeCallinModifier1() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class B1 {\n");
+ buf.append(" public void foo() {};\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" @SuppressWarnings(\"basecall\")\n");
+ buf.append(" callin void foo() {\n");
+ buf.append(" System.out.print(\"OK\");\n");
+ buf.append(" }\n");
+ buf.append(" foo <- after foo;\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cuteam);
+ ArrayList proposals= collectCorrections(cuteam, astRoot);
+ assertNumberOfProposals(proposals, 2);
+ assertCorrectLabels(proposals);
+
+ String[] expectedProposals = new String[2];
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" @SuppressWarnings(\"basecall\") void foo() {\n");// removed callin modifier
+ buf.append(" System.out.print(\"OK\");\n");
+ buf.append(" }\n");
+ buf.append(" foo <- after foo;\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ expectedProposals[0] = buf.toString();
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" @SuppressWarnings(\"basecall\")\n");
+ buf.append(" callin void foo() {\n");
+ buf.append(" System.out.print(\"OK\");\n");
+ buf.append(" }\n");
+ buf.append(" foo <- replace foo;\n"); // changed after to replace
+ buf.append(" }\n");
+ buf.append("}\n");
+ expectedProposals[1] = buf.toString();
+
+
+ assertExpectedExistInProposals(proposals, expectedProposals);
+ }
+
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CalloutQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CalloutQuickFixTest.java
new file mode 100644
index 000000000..574ae7d18
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CalloutQuickFixTest.java
@@ -0,0 +1,417 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: CalloutQuickFixTest.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.core;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.objectteams.otdt.core.ext.OTDTPlugin;
+
+/**
+ * Test OT-specific quickfixes (here: callout related issues).
+ * @author stephan
+ * @since 1.2.8
+ */
+public class CalloutQuickFixTest extends OTQuickFixTest {
+
+
+ private static final Class THIS= CalloutQuickFixTest.class;
+
+ public CalloutQuickFixTest(String name) {
+ super(name);
+ }
+
+ public static Test allTests() {
+ return setUpTest(new TestSuite(THIS));
+ }
+
+ public static Test setUpTest(Test test) {
+ return new ProjectTestSetup(test);
+ }
+
+ public static Test suite() {
+ return allTests();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void addOptions(Hashtable options) {
+ super.addOptions(options);
+ options.put(OTDTPlugin.OT_COMPILER_INFERRED_CALLOUT, JavaCore.WARNING);
+ }
+
+ /* Converting a field read to explicitly use a callout-to-field. */
+ public void testConvertFieldAccessToCalloutCall1() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class B1 {\n");
+ buf.append(" public int val;\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" void foo(){\n");
+ buf.append(" System.out.print(val);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cuteam = pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cuteam);
+ ArrayList proposals= collectCorrections(cuteam, astRoot);
+ assertNumberOfProposals(proposals, 2);
+ assertCorrectLabels(proposals);
+
+ String[] expectedProposals = new String[2];
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" int getVal() -> get int val;\n");
+ buf.append("\n");
+ buf.append(" void foo(){\n");
+ buf.append(" System.out.print(getVal());\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ expectedProposals[0] = buf.toString();
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" @SuppressWarnings(\"inferredcallout\")\n");
+ buf.append(" void foo(){\n");
+ buf.append(" System.out.print(val);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ expectedProposals[1] = buf.toString();
+
+ assertExpectedExistInProposals(proposals, expectedProposals);
+ }
+
+
+ /* Converting a field read (this-qualified) to explicitly use a callout-to-field. */
+ public void testConvertFieldAccessToCalloutCall2() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class B1 {\n");
+ buf.append(" public int val;\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" void foo(){\n");
+ buf.append(" System.out.print(this.val);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cuteam = pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cuteam);
+ ArrayList proposals= collectCorrections(cuteam, astRoot);
+ assertNumberOfProposals(proposals, 2);
+ assertCorrectLabels(proposals);
+
+ String[] expectedProposals = new String[2];
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" int getVal() -> get int val;\n");
+ buf.append("\n");
+ buf.append(" void foo(){\n");
+ buf.append(" System.out.print(this.getVal());\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ expectedProposals[0] = buf.toString();
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" @SuppressWarnings(\"inferredcallout\")\n");
+ buf.append(" void foo(){\n");
+ buf.append(" System.out.print(this.val);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ expectedProposals[1] = buf.toString();
+
+ assertExpectedExistInProposals(proposals, expectedProposals);
+
+ }
+
+ /* Converting a field assignment to explicitly use a callout-to-field. */
+ public void testConvertFieldAccessToCalloutCall3() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class B1 {\n");
+ buf.append(" public int val;\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" void foo(){\n");
+ buf.append(" val = 3;\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cuteam = pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cuteam);
+ ArrayList proposals= collectCorrections(cuteam, astRoot);
+ assertNumberOfProposals(proposals, 2);
+ assertCorrectLabels(proposals);
+
+ String[] expectedProposals = new String[2];
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" void setVal(int val) -> set int val;\n");
+ buf.append("\n");
+ buf.append(" void foo(){\n");
+ buf.append(" setVal(3);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ expectedProposals[0] = buf.toString();
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" @SuppressWarnings(\"inferredcallout\")\n");
+ buf.append(" void foo(){\n");
+ buf.append(" val = 3;\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ expectedProposals[1] = buf.toString();
+
+ assertExpectedExistInProposals(proposals, expectedProposals);
+
+ }
+
+ /* Converting a field assignment (this-qualified) to explicitly use a callout-to-field. */
+ public void testConvertFieldAccessToCalloutCall4() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class B1 {\n");
+ buf.append(" public int val;\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" void foo(){\n");
+ buf.append(" this.val = 3;\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cuteam = pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cuteam);
+ ArrayList proposals= collectCorrections(cuteam, astRoot);
+ assertNumberOfProposals(proposals, 2);
+ assertCorrectLabels(proposals);
+
+ String[] expectedProposals = new String[2];
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" void setVal(int val) -> set int val;\n");
+ buf.append("\n");
+ buf.append(" void foo(){\n");
+ buf.append(" this.setVal(3);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+
+ expectedProposals[0] = buf.toString();
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" @SuppressWarnings(\"inferredcallout\")\n");
+ buf.append(" void foo(){\n");
+ buf.append(" this.val = 3;\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ expectedProposals[1] = buf.toString();
+
+ assertExpectedExistInProposals(proposals, expectedProposals);
+ }
+
+
+ /* Convert field access to call to existing callout-to-field. */
+ public void testConvertFieldAccessToCalloutCall5() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class B1 {\n");
+ buf.append(" public int val;\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" int getVal() -> get int val;\n");
+ buf.append("\n");
+ buf.append(" void foo(){\n");
+ buf.append(" System.out.print(val);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cuteam);
+ ArrayList proposals= collectCorrections(cuteam, astRoot);
+ assertNumberOfProposals(proposals, 2);
+ assertCorrectLabels(proposals);
+
+ String[] expectedProposals = new String[2];
+
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" int getVal() -> get int val;\n");
+ buf.append("\n");
+ buf.append(" void foo(){\n");
+ buf.append(" System.out.print(getVal());\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ expectedProposals[0] = buf.toString();
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" int getVal() -> get int val;\n");
+ buf.append("\n");
+ buf.append(" @SuppressWarnings(\"inferredcallout\")\n");
+ buf.append(" void foo(){\n");
+ buf.append(" System.out.print(val);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ expectedProposals[1] = buf.toString();
+
+ assertExpectedExistInProposals(proposals, expectedProposals);
+ }
+
+ /* Convert field assignment to call to existing callout-to-field. */
+ public void testConvertFieldAccessToCalloutCall6() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class B1 {\n");
+ buf.append(" public int val;\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" void setVal(int val) -> set int val;\n");
+ buf.append("\n");
+ buf.append(" void foo(){\n");
+ buf.append(" this.val = 3;\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cuteam = pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cuteam);
+ ArrayList proposals= collectCorrections(cuteam, astRoot);
+ assertNumberOfProposals(proposals, 2);
+ assertCorrectLabels(proposals);
+
+ String[] expectedProposals = new String[2];
+
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" void setVal(int val) -> set int val;\n");
+ buf.append("\n");
+ buf.append(" void foo(){\n");
+ buf.append(" this.setVal(3);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ expectedProposals[0] = buf.toString();
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class R playedBy B1 {\n");
+ buf.append(" void setVal(int val) -> set int val;\n");
+ buf.append("\n");
+ buf.append(" @SuppressWarnings(\"inferredcallout\")\n");
+ buf.append(" void foo(){\n");
+ buf.append(" this.val = 3;\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ expectedProposals[1] = buf.toString();
+
+ assertExpectedExistInProposals(proposals, expectedProposals);
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java
new file mode 100644
index 000000000..a63cd8540
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CodeCompletionTest.java
@@ -0,0 +1,1350 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: CodeCompletionTest.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.core;
+
+import static org.eclipse.jdt.internal.codeassist.RelevanceConstants.*;
+
+import java.util.Hashtable;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
+import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
+import org.eclipse.jdt.internal.corext.template.java.CodeTemplateContextType;
+import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
+import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
+import org.eclipse.jdt.internal.ui.text.java.JavaCompletionProcessor;
+import org.eclipse.jdt.internal.ui.text.java.ParameterGuessingProposal;
+import org.eclipse.jdt.testplugin.TestOptions;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jdt.ui.PreferenceConstants;
+import org.eclipse.jdt.ui.tests.core.CoreTests;
+import org.eclipse.jdt.ui.text.IJavaPartitions;
+import org.eclipse.jdt.ui.text.java.CompletionProposalCollector;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
+import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextOperationTarget;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposalExtension;
+import org.eclipse.jface.text.contentassist.ICompletionProposalExtension2;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.objectteams.otdt.internal.ui.assist.CompletionAdaptor;
+import org.eclipse.objectteams.otdt.ui.tests.util.JavaProjectHelper;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * Tests for code completion including the UI part
+ * i.e., testing the actual rewriting and also selections.
+ *
+ * @author stephan
+ * @since 1.1.8
+ */
+public class CodeCompletionTest extends CoreTests {
+
+ private static final int INTERESTING_CALLIN_CALLOUT_PROPOSAL = CompletionAdaptor.R_METHOD_MAPPING+R_DEFAULT+R_INTERESTING+R_CASE+R_UNQUALIFIED+R_NON_RESTRICTED;
+ private static final int VERY_INTERESTING_CALLIN_CALLOUT_PROPOSAL = INTERESTING_CALLIN_CALLOUT_PROPOSAL+R_EXPECTED_TYPE;
+
+ private static final Class<CodeCompletionTest> THIS= CodeCompletionTest.class;
+
+
+ public static Test allTests() {
+ return new ProjectTestSetup(new TestSuite(THIS));
+ }
+
+ public static Test setUpTest(Test test) {
+ return new ProjectTestSetup(test);
+ }
+
+ @SuppressWarnings("unused") // dead code inside
+ public static Test suite() {
+ if (true) {
+ return allTests();
+ } else {
+ TestSuite suite= new TestSuite();
+ suite.addTest(new CodeCompletionTest("testCreateCalloutOverride1"));
+ return new ProjectTestSetup(suite);
+ }
+ }
+
+ private IJavaProject fJProject1;
+
+ public CodeCompletionTest(String name) {
+ super(name);
+ }
+
+ private void codeComplete(ICompilationUnit cu, int offset, CompletionProposalCollector collector) throws JavaModelException {
+ waitBeforeCoreCompletion(); // ??
+ cu.codeComplete(offset, collector);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ fJProject1= JavaProjectHelper.createOTJavaProject("OTTestProject1", "bin");
+ JavaProjectHelper.addRTJar(fJProject1);
+ JavaProjectHelper.addRequiredProject(fJProject1, ProjectTestSetup.getProject());
+
+ Hashtable<String, String> options= TestOptions.getDefaultOptions();
+ options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, "1");
+ options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
+ options.put(JavaCore.CODEASSIST_FIELD_PREFIXES, "f");
+ JavaCore.setOptions(options);
+
+ IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
+ store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, true);
+ store.setValue(PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS, false);
+ store.setValue(PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS, false);
+
+ StubUtility.setCodeTemplate(CodeTemplateContextType.OVERRIDECOMMENT_ID, "/* (non-Javadoc)\n * ${see_to_overridden}\n */", null); // TODO(SH): this one is currently used for method bindings, see TODO in CompletionAdaptor.Stubs#createCallout
+ StubUtility.setCodeTemplate(CodeTemplateContextType.DELEGATECOMMENT_ID, "/* (non-Javadoc)\n * ${see_to_target}\n */", null);
+ StubUtility.setCodeTemplate(CodeTemplateContextType.METHODSTUB_ID, "//TODO\n${body_statement}", null);
+ StubUtility.setCodeTemplate(CodeTemplateContextType.CONSTRUCTORCOMMENT_ID, "/**\n * Constructor.\n */", null);
+ StubUtility.setCodeTemplate(CodeTemplateContextType.METHODCOMMENT_ID, "/**\n * Method.\n */", null);
+ StubUtility.setCodeTemplate(CodeTemplateContextType.CONSTRUCTORSTUB_ID, "//TODO\n${body_statement}", null);
+ StubUtility.setCodeTemplate(CodeTemplateContextType.GETTERCOMMENT_ID, "/**\n * @return the ${bare_field_name}\n */", fJProject1);
+ StubUtility.setCodeTemplate(CodeTemplateContextType.SETTERCOMMENT_ID, "/**\n * @param ${param} the ${bare_field_name} to set\n */", fJProject1);
+
+ fBeforeImports= "";
+ fAfterImports= "";
+ fMembers= "";
+ fLocals= "";
+ fTrigger= '\0';
+ fWaitBeforeCompleting= false;
+ }
+
+ protected void tearDown() throws Exception {
+ IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
+ store.setToDefault(PreferenceConstants.CODEGEN_ADD_COMMENTS);
+ store.setToDefault(PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS);
+ store.setToDefault(PreferenceConstants.CODEASSIST_SHOW_VISIBLE_PROPOSALS);
+ closeAllEditors();
+ JavaProjectHelper.delete(fJProject1);
+ }
+
+ public static void closeEditor(IEditorPart editor) {
+ IWorkbenchPartSite site;
+ IWorkbenchPage page;
+ if (editor != null && (site= editor.getSite()) != null && (page= site.getPage()) != null)
+ page.closeEditor(editor, false);
+ }
+
+ public static void closeAllEditors() {
+ IWorkbenchWindow[] windows= PlatformUI.getWorkbench().getWorkbenchWindows();
+ for (int i= 0; i < windows.length; i++) {
+ IWorkbenchPage[] pages= windows[i].getPages();
+ for (int j= 0; j < pages.length; j++) {
+ IEditorReference[] editorReferences= pages[j].getEditorReferences();
+ for (int k= 0; k < editorReferences.length; k++)
+ closeEditor(editorReferences[k].getEditor(false));
+ }
+ }
+ }
+
+ /* Legacy style of testing: */
+ public void _testCreateCalloutCompletion() throws Exception {
+ IPackageFragmentRoot sourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src");
+
+ // create base class:
+ IPackageFragment pack1= sourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class B {\n");
+ buf.append(" public void foo() {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ String contents= buf.toString();
+
+ pack1.createCompilationUnit("B.java", contents, false, null);
+
+ // create team class:
+ IPackageFragment pack2= sourceFolder.createPackageFragment("test2", false, null);
+ buf= new StringBuffer();
+ buf.append("package test2;\n");
+ buf.append("import base test1.B;\n");
+ buf.append("public team class T {\n");
+ buf.append(" public class R playedBy B {\n");
+ buf.append(" fo\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ contents= buf.toString();
+
+ ICompilationUnit cuT= pack2.createCompilationUnit("T.java", contents, false, null);
+
+ fEditor= (JavaEditor)JavaUI.openInEditor(cuT);
+
+ String str= " fo";
+
+ int offset= contents.indexOf(str) + str.length();
+
+ CompletionProposalCollector collector= createCollector(cuT, offset);
+ collector.setReplacementLength(0);
+ codeComplete(cuT, offset, collector);
+ IJavaCompletionProposal[] proposals= collector.getJavaCompletionProposals();
+
+ assertTrue("proposals", proposals.length >= 1);
+ IJavaCompletionProposal selected= null;
+ for (IJavaCompletionProposal javaCompletionProposal : proposals) {
+ if (javaCompletionProposal.getDisplayString().startsWith("foo() void - Binding")) {
+ selected= javaCompletionProposal;
+ break;
+ }
+ }
+ assertNotNull("expected proposal", selected);
+
+ IDocument doc= fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput());
+ selected.apply(doc);
+
+ buf= new StringBuffer();
+ buf.append("package test2;\n" +
+ "import base test1.B;\n" +
+ "public team class T {\n" +
+ " public class R playedBy B {\n" +
+ "\n" +
+ " /* (non-Javadoc)\n" +
+ " * @see test1.B#foo()\n" +
+ " */\n" +
+ " void foo() -> void foo();\n" +
+ " \n" +
+ " }\n" +
+ "}\n" +
+ "");
+ assertEqualString(doc.get(), buf.toString());
+ }
+ // helpers for above:
+ private CompletionProposalCollector createCollector(ICompilationUnit cu, int offset) throws PartInitException, JavaModelException {
+ CompletionProposalCollector collector= new CompletionProposalCollector(cu);
+ collector.setInvocationContext(createContext(offset, cu));
+ return collector;
+ }
+
+ private JavaContentAssistInvocationContext createContext(int offset, ICompilationUnit cu) throws PartInitException, JavaModelException {
+ JavaEditor editor= (JavaEditor) JavaUI.openInEditor(cu);
+ ISourceViewer viewer= editor.getViewer();
+ return new JavaContentAssistInvocationContext(viewer, offset, editor);
+ }
+
+ // ==== START REAL TESTS: ====
+
+ /** At the empty space within a role one could create a constructor. */
+ public void testCreateRoleConstructor() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " |",
+ "R(",
+ " /**\n" +
+ " * Constructor.\n" +
+ " */\n" +
+ " public R(B b) {\n" +
+ " //TODO\n" +
+ "\n" +
+ " }",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ public void testCreateCallout1() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " fo|",
+ "foo(",
+ "\n" + // TODO(SH): initial newline is not intended?
+ " /* (non-Javadoc)\n" +
+ " * @see test1.B#foo()\n" +
+ " */\n" +
+ " void |foo|() -> void foo();\n" +
+ " ",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+ // abstract method exists:
+ public void testCreateCallout1a() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " abstract void foo();\n"+
+ " fo|",
+ "foo(",
+ " abstract void foo();\n"+
+ "\n" + // TODO(SH): initial newline is not intended?
+ " /* (non-Javadoc)\n" +
+ " * @see test1.B#foo()\n" +
+ " */\n" +
+ " void |foo|() -> void foo();\n" +
+ " ",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ // ROFI
+ public void testCreateCallout2() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertROFIBodyProposal(
+ " fo|",
+ "foo(",
+ "\n" + // TODO(SH): initial newline is not intended?
+ " /* (non-Javadoc)\n" +
+ " * @see test1.B#foo()\n" +
+ " */\n" +
+ " void |foo|() -> void foo();\n" +
+ " ",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ public void testCreateCalloutOverride1() throws Exception {
+ IPackageFragment pkg = CompletionTestSetup.getTestPackage("p1");
+ pkg.createCompilationUnit("SuperTeam.java",
+ "package test1.p1;\n" +
+ "public team class SuperTeam {\n" +
+ " public class MyRole {\n" +
+ " String blub(int i) { return \"\"; }\n" +
+ " }\n" +
+ "}\n",
+ true, null);
+
+ pkg.createCompilationUnit("ABase.java",
+ "package test1.p1;\n" +
+ "public class ABase {\n" +
+ " String blub(int k) { return null; }\n" +
+ "}\n",
+ true, null);
+
+ StringBuffer subTeamContent = new StringBuffer();
+ subTeamContent.append("package test1;\n");
+ subTeamContent.append("import test1.p1.SuperTeam;\n");
+ subTeamContent.append("import base test1.p1.ABase;\n");
+ subTeamContent.append("public team class Completion_testCreateCalloutOverride1 extends SuperTeam {\n");
+ subTeamContent.append(" protected class MyRole playedBy ABase {\n");
+ subTeamContent.append(" \n");
+ subTeamContent.append(" }\n");
+ subTeamContent.append("}");
+
+ StringBuffer expectedContent = new StringBuffer();
+ expectedContent.append("package test1;\n");
+ expectedContent.append("import test1.p1.SuperTeam;\n");
+ expectedContent.append("import base test1.p1.ABase;\n");
+ expectedContent.append("public team class Completion_testCreateCalloutOverride1 extends SuperTeam {\n");
+ expectedContent.append(" protected class MyRole playedBy ABase {\n");
+ expectedContent.append("\n");
+ expectedContent.append(" /* (non-Javadoc)\n");
+ expectedContent.append(" * @see test1.p1.ABase#blub(int)\n");
+ expectedContent.append(" */\n");
+ expectedContent.append(" String blub(int k) => String blub(int k);\n");
+ expectedContent.append(" \n");
+ expectedContent.append(" }\n");
+ expectedContent.append("}");
+
+ String completeAfter = " ";
+ int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
+ int posAfter = expectedContent.indexOf("blub(int k)");
+
+ // discriminate from overriding "blub(int i)":
+ assertProposal("blub(int k", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 4), 0); // len of "blub"
+ }
+
+
+ // callout override to field
+ public void testCreateCalloutOverride2() throws Exception {
+ IPackageFragment pkg = CompletionTestSetup.getTestPackage("p1");
+ pkg.createCompilationUnit("SuperTeam.java",
+ "package test1.p1;\n" +
+ "public team class SuperTeam {\n" +
+ " public class MyRole {\n" +
+ " void setBlub(int i) { }\n" +
+ " }\n" +
+ "}\n",
+ true, null);
+
+ pkg.createCompilationUnit("ABase.java",
+ "package test1.p1;\n" +
+ "public class ABase {\n" +
+ " int blub;\n" +
+ "}\n",
+ true, null);
+
+ StringBuffer subTeamContent = new StringBuffer();
+ subTeamContent.append("package test1;\n");
+ subTeamContent.append("import test1.p1.SuperTeam;\n");
+ subTeamContent.append("import base test1.p1.ABase;\n");
+ subTeamContent.append("public team class Completion_testCreateCalloutOverride1 extends SuperTeam {\n");
+ subTeamContent.append(" protected class MyRole playedBy ABase {\n");
+ subTeamContent.append(" set\n");
+ subTeamContent.append(" }\n");
+ subTeamContent.append("}");
+
+ StringBuffer expectedContent = new StringBuffer();
+ expectedContent.append("package test1;\n");
+ expectedContent.append("import test1.p1.SuperTeam;\n");
+ expectedContent.append("import base test1.p1.ABase;\n");
+ expectedContent.append("public team class Completion_testCreateCalloutOverride1 extends SuperTeam {\n");
+ expectedContent.append(" protected class MyRole playedBy ABase {\n");
+ expectedContent.append("\n");
+ expectedContent.append(" /**\n");
+ expectedContent.append(" * \n");
+ expectedContent.append(" */\n");
+ expectedContent.append(" void setBlub(int blub) => set int blub;\n");
+ expectedContent.append(" \n");
+ expectedContent.append(" }\n");
+ expectedContent.append("}");
+
+ String completeAfter = " set";
+ int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
+ int posAfter = expectedContent.indexOf(" ");
+
+ // discriminate from overriding "setBlub(int i)":
+ assertProposal("setBlub(int)", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter+2, 0), 0);
+ }
+
+
+ public void testCompleteCallout1() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " void foo() ->|",
+ "foo(",
+ " void foo() ->| void foo();|" + // SH: why selected?
+ "",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ public void testCompleteCallout2() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " foo -> |",
+ "foo(",
+ " foo -> foo; |" + // SH: trailing space?
+ "",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* short, no callinModifier, callin-method, follows: short callin. */
+ public void testCompleteCallout3() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " callin void bar() {}\n"+
+ " void foo() ->|\n" + // no leading space, inserted below (good)
+ " bar <- replace clone;\n",
+ "foo(",
+ " callin void bar() {}\n" +
+ " void foo() ->| void foo();|\n" +
+ " bar <- replace clone;\n" +
+ "",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* short, prefix typed, follows: method */
+ public void testCompleteCallout4() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " foo -> f|",
+ "foo(",
+ " foo -> |foo;|",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ public void testCompleteCallout5() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " |",
+ "foo(",
+ "\n"+
+ " /* (non-Javadoc)\n" +
+ " * @see test1.B#foo()\n" +
+ " */\n" +
+ " void |foo|() -> void foo();\n" +
+ " ",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ public void testCompleteCallout6() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertROFIBodyProposal(
+ " |",
+ "foo(",
+ "\n"+
+ " /* (non-Javadoc)\n" +
+ " * @see test1.B#foo()\n" +
+ " */\n" +
+ " void |foo|() -> void foo();\n" +
+ " ",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ // callout to static from ROFI
+ public void testCompleteCallout7() throws Exception {
+ createBaseClass(" public static void foo() {}\n");
+ assertROFIBodyProposal(
+ " |",
+ "foo(",
+ "\n"+
+ " /* (non-Javadoc)\n" +
+ " * @see test1.B#foo()\n" +
+ " */\n" +
+ " void |foo|() -> void foo();\n" +
+ " ",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /** A base method spec with return type and beginning of the selector is searched. */
+ public void testCompletionMethodSpecLong1() throws Exception {
+ createBaseClass("");
+ assertTypeBodyProposal(
+ " String toString() => String toStr|",
+ "toString(",
+ " String toString() => |String toString();|",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+
+ /** A base method spec without return type and beginning of the selector is searched. */
+ public void testCompletionMethodSpecLong2() throws Exception {
+ createBaseClass("");
+ assertTypeBodyProposal(
+ " String toString() => toStr|",
+ "toString(",
+ " String toString() => |String toString();|",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /** A base method spec with return type and no selector is searched. */
+ public void testCompletionMethodSpecLong3() throws Exception {
+ createBaseClass("");
+ assertTypeBodyProposal(
+ " String toString() => String |",
+ "toString(",
+ " String toString() => String toString(); |", // trailing space?
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* short, no callinModifier, follows: method */
+ public void testCompleteCallin1() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " void bar() {}\n"+
+ " bar <-|\n" + // no space, inserted below (good)
+ " void zork() {}\n",
+ "foo(",
+ " void bar() {}\n" +
+ " bar <- |before| foo;\n" +
+ " void zork() {}\n" +
+ "",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+ // concrete method exists, create full callin binding (cf. testCreateCallout1a()).
+ public void testCreateCallin1a() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " void foo() {}\n"+
+ " fo|",
+ "foo(",
+ " void foo() {}\n"+
+ "\n" + // TODO(SH): initial newline is not intended?
+ " /* (non-Javadoc)\n" +
+ " * @see test1.B#foo()\n" +
+ " */\n" +
+ " void |foo|() <- before void foo();\n" +
+ " ",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* short, with callinModifier, follows: callout binding. */
+ public void testCompleteCallin2() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " void bar() {}\n"+
+ " bar <- after |\n" +
+ " void foo() -> void foo();\n",
+ "foo(",
+ " void bar() {}\n" +
+ " bar <- after foo; |\n" + // SH: trailing space?
+ " void foo() -> void foo();\n" +
+ "",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+
+ /* short, with callinModifier, follows: callout binding, non-keyword return type. */
+ public void testCompleteCallin2a() throws Exception {
+ createBaseClass(" public String foo() { return null; }\n");
+ assertTypeBodyProposal(
+ " String bar() { return \"\"; }\n"+
+ " bar <- after |\n" +
+ " String foo() -> String foo();\n",
+ "foo(",
+ " String bar() { return \"\"; }\n" +
+ " bar <- after foo; |\n" + // SH: trailing space?
+ " String foo() -> String foo();\n" +
+ "",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* long, with callinModifier, follows: field. */
+ public void testCompleteCallin3() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " void bar() {}\n"+
+ " void bar() <-after |\n" + // cannot insert space before modifier (OK)
+ " int i;\n",
+ "foo(",
+ " void bar() {}\n" +
+ " void bar() <-after void foo(); |\n" +
+ " int i;\n" +
+ "",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* long, no callinModifier, callin-method, follows: field. */
+ public void testCompleteCallin4() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " callin void bar() {}\n"+
+ " void bar() <- |\n" +
+ " int i;\n",
+ "foo(",
+ " callin void bar() {}\n" +
+ " void bar() <- |replace| void foo(); \n" +
+ " int i;\n" +
+ "",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* long, no callinModifier, callin-method, follows: method. */
+ public void testCompleteCallin5() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " callin void bar() {}\n"+
+ " void bar() <-|\n" + // no leading space, inserted below (good)
+ " int zork() {}\n",
+ "foo(",
+ " callin void bar() {}\n" +
+ " void bar() <- |replace| void foo();\n" +
+ " int zork() {}\n" +
+ "",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* long, no callinModifier, callin-method, follows: short callin. */
+ public void testCompleteCallin6() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " callin void bar() {}\n"+
+ " void bar() <-|\n" + // no leading space, inserted below (good)
+ " bar <- replace clone;\n",
+ "foo(",
+ " callin void bar() {}\n" +
+ " void bar() <- |replace| void foo();\n" +
+ " bar <- replace clone;\n" +
+ "",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* long, no callinModifier, callin-method, follows: short callin. */
+ public void testCompleteCallin7() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " callin void bar() {}\n"+
+ " bar <- replace |\n" +
+ " bar <- replace clone;\n",
+ "foo",
+ " callin void bar() {}\n" +
+ " bar <- replace foo; |\n" + // SH: trailing space?
+ " bar <- replace clone;\n" +
+ "",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* short, prefix typed, with callinModifier, follows: callout binding. */
+ public void testCompleteCallin8() throws Exception {
+ createBaseClass(" public void foo() {}\n");
+ assertTypeBodyProposal(
+ " void bar() {}\n"+
+ " bar <- after f|\n" +
+ " void foo() -> void foo();\n",
+ "foo(",
+ " void bar() {}\n" +
+ " bar <- after |foo;|\n" +
+ " void foo() -> void foo();\n" +
+ "",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ public void testCompleteBasecall1() throws Exception {
+ createBaseClass(" public String getBaseText(Object object) {return null;}\n");
+ assertTypeBodyProposal(
+ " callin String getText(Object o) {\n"+
+ " return base.|\n" +
+ " }\n" +
+ " getText <- replace getBaseText;\n",
+ "", // should only have one proposal, so accept any to see if there are others
+ " callin String getText(Object o) {\n"+
+ " return base.getText(|o|)\n" +
+ " }\n" +
+ " getText <- replace getBaseText;\n" +
+ "",
+ 0); // should only have one proposal, so accept any to see if there are others
+ }
+
+ public void testCompleteTSuperCall1() throws Exception {
+ IPackageFragmentRoot sourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src");
+
+ IPackageFragment pack1= sourceFolder.createPackageFragment("test1", false, null);
+ String contents= "package test1;\n" +
+ "\n" +
+ "public team class CompletionTeam0 {\n" +
+ " protected class R {\n" +
+ " void foomethod(int i) {}\n" +
+ " void foomethod(String s) {}\n" +
+ " void barmethod(int i) {}\n" +
+ " }\n" +
+ "}\n";
+ pack1.createCompilationUnit("CompletionTeam0.java", contents, false, null);
+
+ contents= "package test1;\n" +
+ "\n" +
+ "public team class CompletionTeam1 extends CompletionTeam0 {\n" +
+ " protected class R {\n" +
+ " void foomethod(int i) {\n" +
+ " tsuper.//here\n" +
+ " }\n" +
+ " }\n" +
+ "}\n";
+ ICompilationUnit cu1= pack1.createCompilationUnit("CompletionTeam1.java", contents, false, null);
+
+ String str= "//here";
+
+ int offset= contents.indexOf(str);
+
+ CompletionProposalCollector collector= createCollector(cu1, offset);
+ collector.setReplacementLength(0);
+
+ codeComplete(cu1, offset, collector);
+
+ IJavaCompletionProposal[] proposals= collector.getJavaCompletionProposals();
+
+ // strictly expect one method only.
+ assertEquals(1, proposals.length);
+ assertAppliedProposal(contents, proposals[0], "foomethod()"); // arguments are not inserted by this method :(
+ }
+
+ // see Trac #126
+ public void testCompleteInCallinMethod1() throws Exception {
+ createBaseClass(" public String getText() { return null; }\n");
+ ICompletionProposal proposal = assertTypeBodyProposal(
+ " void foo(int i) {} \n" +
+ " callin void getText() {\n" +
+ " int idx = 3;\n" +
+ " foo|;\n" +
+ " }\n" +
+ " getText <- replace getText;\n",
+ "foo", // this is just step 1.
+ " void foo(int i) {} \n" +
+ " callin void getText() {\n" +
+ " int idx = 3;\n" +
+ " foo(|i|);\n" +
+ " }\n" +
+ " getText <- replace getText;\n" +
+ "",
+ 0); // should only have one proposal, so accept any to see if there are others
+ // this is the interesting check: choices??
+ assertChoices(proposal, new String[][]{new String[]{"i", "idx", "0"}});
+ }
+
+ /* Full c-t-f declaration */
+ public void testCalloutToField1() throws Exception {
+ createBaseClass("public int myField;\n");
+ assertTypeBodyProposal(
+ " void bar() {}\n"+
+ " get|\n"+
+ " void blub() {}\n",
+ "getMyField",
+ " void bar() {}\n"+
+ " /**\n" +
+ " * \n" + // TODO(SH): define method binding comment templates
+ " */\n" +
+ " int getMyField() -> get int myField;\n"+
+ " |\n"+ // TODO(SH): newline not intended?
+ " void blub() {}\n"+
+ "",
+ INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* after modifier w/o trailing space */
+ public void testCalloutToField2() throws Exception {
+ createBaseClass("public int myField;\n");
+ assertTypeBodyProposal(
+ " void bar() {}\n"+
+ " int getMyField() -> get|\n"+
+ " void blub() {}\n",
+ " int",
+ " void bar() {}\n"+
+ " int getMyField() -> get int myField;|\n"+
+ " void blub() {}\n"+
+ "",
+ VERY_INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* after modifier w/ trailing space */
+ public void testCalloutToField3() throws Exception {
+ createBaseClass("public int myField;\n");
+ assertTypeBodyProposal(
+ " void bar() {}\n"+
+ " void setMyField(int v) -> set |\n"+
+ " void blub() {}\n",
+ "int",
+ " void bar() {}\n"+
+ " void setMyField(int v) -> set int myField;|\n"+
+ " void blub() {}\n"+
+ "",
+ VERY_INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* after modifier w/ trailing space - multiple base fields */
+ public void testCalloutToField4() throws Exception {
+ createBaseClass("public int myField;\n"+
+ "public int yourField;\n"+
+ "public boolean nobodysField;");
+ assertTypeBodyProposal(
+ " void bar() {}\n"+
+ " int getMyField() -> get |\n"+
+ " void blub() {}\n",
+ "int y",
+ " void bar() {}\n"+
+ " int getMyField() -> get int yourField;|\n"+
+ " void blub() {}\n"+
+ "",
+ VERY_INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* after modifier w/ trailing space - multiple base fields, mismatching type */
+ public void testCalloutToField5() throws Exception {
+ createBaseClass("public int myField;\n"+
+ "public int yourField;\n"+
+ "public boolean nobodysField;");
+ assertNosuchTypeBodyProposal(
+ " void bar() {}\n"+
+ " int getMyField() -> get |\n"+
+ " void blub() {}\n",
+ "boolean",
+ VERY_INTERESTING_CALLIN_CALLOUT_PROPOSAL);
+ }
+
+ /* Don't accidentally propose a getter for _OT$base: */
+ public void testCalloutToField6() throws Exception {
+ createBaseClass("public int myField;\n"+
+ "public int yourField;\n"+
+ "public boolean nobodysField;");
+ assertNosuchTypeBodyProposal(
+ " void bar() {}\n"+
+ " get|\n"+
+ " void blub() {}\n",
+ "get_",
+ 100);
+ }
+
+ public void testPlayedBy1() throws Exception {
+ createBaseClass("test2", "MyBase", "");
+ fBeforeImports= "";
+ fAfterImports= "\nimport base test2.MyBase;\n";
+ assertTypeBodyProposal(
+ "protected class R playedBy MyBa| {\n" +
+ "}\n",
+ "MyBase",
+ "protected class R playedBy MyBase| {\n" +
+ "}\n",
+ 0, false);
+ }
+
+ public void testPlayedBy2() throws Exception {
+ createBaseClass("test2", "AClass", "");
+ fBeforeImports= "";
+ fAfterImports= "\nimport base test2.AClass;\n";
+ assertTypeBodyProposal(
+ "protected class AClass playedBy A| {\n" +
+ "}\n",
+ "ACl",
+ "protected class AClass playedBy AClass| {\n" +
+ "}\n",
+ 0, false);
+ }
+
+ public void testBaseGuard1() throws Exception {
+ createBaseClass("test2", "AClass", "public boolean check() { return false; }");
+ fBeforeImports = "import base test2.AClass;";
+ fAfterImports = "import base test2.AClass;";
+ assertTypeBodyProposal(
+ "protected class ARole playedBy AClass\n" +
+ " base when (base.|)\n" +
+ "{\n" +
+ "}\n",
+ "che",
+ "protected class ARole playedBy AClass\n" +
+ " base when (base.check()|)\n" +
+ "{\n" +
+ "}\n",
+ 0, false);
+ }
+
+ public void testBaseGuard2() throws Exception {
+ createBaseClass("test2", "AClass", "");
+ assertTypeBodyProposal(
+ "protected class ARole playedBy AClass\n" +
+ " ba|\n" +
+ "{\n" +
+ "}\n",
+ "base",
+ "protected class ARole playedBy AClass\n" +
+ " base when (|)\n" +
+ "{\n" +
+ "}\n",
+ 0, false);
+ }
+ public void testBaseGuard3() throws Exception {
+ createBaseClass("test2", "AClass", "public boolean check() { return false; }");
+ assertTypeBodyProposal(
+ "protected class ARole playedBy AClass {\n" +
+ " toString <- after check w| \n" +
+ "}\n",
+ "wh",
+ "protected class ARole playedBy AClass {\n" +
+ " toString <- after check when (|) \n" +
+ "}\n",
+ 0, false);
+ }
+ public void testBaseGuard4() throws Exception {
+ createBaseClass("test2", "AClass", "public String check() { return false; }");
+ assertTypeBodyProposal(
+ "protected class ARole playedBy AClass {\n" +
+ " String toString() <- after String check() w| \n" +
+ "}\n",
+ "wh",
+ "protected class ARole playedBy AClass {\n" +
+ " String toString() <- after String check() when (|) \n" +
+ "}\n",
+ 0, false);
+ }
+
+
+ public void testRoleTag1() throws Exception {
+ IPackageFragment teamPkg = CompletionTestSetup.getTestPackage("MyTeam");
+ teamPkg.createCompilationUnit("MyRole.java",
+ "team package test1.MyTeam;\n" +
+ "public class MyRole {}\n",
+ true, null);
+ StringBuffer teamContent = new StringBuffer();
+ teamContent.append("package test1;\n");
+ teamContent.append("/** @role My */\n");
+ teamContent.append("public team class MyTeam {\n");
+ teamContent.append(" MyRole roleField;\n"); // trigger loading
+ teamContent.append(" protected class MyOtherRole {}\n");
+ teamContent.append("}");
+
+ StringBuffer expectedContent = new StringBuffer();
+ expectedContent.append("package test1;\n");
+ expectedContent.append("/** @role MyRole */\n");
+ expectedContent.append("public team class MyTeam {\n");
+ expectedContent.append(" MyRole roleField;\n");
+ expectedContent.append(" protected class MyOtherRole {}\n");
+ expectedContent.append("}");
+
+ String completeAfter = "@role My";
+ int pos = teamContent.indexOf(completeAfter)+completeAfter.length();
+
+ assertProposal("My", null, null, teamContent, new Region(pos, 0), expectedContent, new Region(pos+4, 0), 0); // 4: len(MyRole)-len(My)
+ }
+
+ public void testRoleTag2() throws Exception {
+ IPackageFragment teamPkg = CompletionTestSetup.getTestPackage("MyTeam");
+ teamPkg.createCompilationUnit("MyRole.java",
+ "team package test1.MyTeam;\n" +
+ "public class MyRole {}\n",
+ true, null);
+ StringBuffer teamContent = new StringBuffer();
+ teamContent.append("package test1;\n");
+ teamContent.append("/** @role */\n");
+ teamContent.append("public team class MyTeam {\n");
+ teamContent.append(" MyRole roleField;\n"); // trigger loading
+ teamContent.append(" protected class MyOtherRole {}\n");
+ teamContent.append("}");
+
+ StringBuffer expectedContent = new StringBuffer();
+ expectedContent.append("package test1;\n");
+ expectedContent.append("/** @role MyRole */\n");
+ expectedContent.append("public team class MyTeam {\n");
+ expectedContent.append(" MyRole roleField;\n");
+ expectedContent.append(" protected class MyOtherRole {}\n");
+ expectedContent.append("}");
+
+ String completeAfter = "@role ";
+ int pos = teamContent.indexOf(completeAfter)+completeAfter.length();
+
+ assertProposal("", null, null, teamContent, new Region(pos, 0), expectedContent, new Region(pos+6, 0), 0); // 6: len(MyRole)
+ }
+
+
+ public void testCreateMethod1() throws Exception {
+ IPackageFragment pkg = CompletionTestSetup.getTestPackage("p1");
+ pkg.createCompilationUnit("SuperTeam.java",
+ "package test1.p1;\n" +
+ "public team class SuperTeam {\n" +
+ " public class MyRole {\n" +
+ " String blub(int i) { return \"\"; }\n" +
+ " }\n" +
+ "}\n",
+ true, null);
+
+ StringBuffer subTeamContent = new StringBuffer();
+ subTeamContent.append("package test1;\n");
+ subTeamContent.append("import test1.p1.SuperTeam;\n");
+ subTeamContent.append("public team class Completion_testCreateMethod1 extends SuperTeam {\n");
+ subTeamContent.append(" protected class MyRole {\n");
+ subTeamContent.append(" blu\n");
+ subTeamContent.append(" }\n");
+ subTeamContent.append("}");
+
+ StringBuffer expectedContent = new StringBuffer();
+ expectedContent.append("package test1;\n");
+ expectedContent.append("import test1.p1.SuperTeam;\n");
+ expectedContent.append("public team class Completion_testCreateMethod1 extends SuperTeam {\n");
+ expectedContent.append(" protected class MyRole {\n");
+ expectedContent.append(" /* (non-Javadoc)\n");
+ expectedContent.append(" * @see test1.p1.SuperTeam.MyRole#blub(int)\n");
+ expectedContent.append(" */\n");
+ expectedContent.append(" @Override\n");
+ expectedContent.append(" String blub(int i) {\n");
+ expectedContent.append(" //TODO\n");
+ expectedContent.append(" return tsuper.blub(i);\n");
+ expectedContent.append(" }\n");
+ expectedContent.append(" }\n");
+ expectedContent.append("}");
+
+ String completeAfter = "blu";
+ int pos = subTeamContent.indexOf(completeAfter)+completeAfter.length();
+ int posAfter = expectedContent.indexOf("}")+1;
+
+ assertProposal("", null, null, subTeamContent, new Region(pos, 0), expectedContent, new Region(posAfter, 0), 0);
+ }
+
+ // == Below: Helper methods/fields. ==
+
+ private void createBaseClass(String classBody)
+ throws JavaModelException, CoreException
+ {
+ createBaseClass("test1", "B", classBody);
+ }
+ private void createBaseClass(String basePackage, String className, String classBody)
+ throws JavaModelException, CoreException
+ {
+ // create a base class:
+ StringBuffer buf= new StringBuffer();
+ buf.append("package "+basePackage+";\n");
+ buf.append("public class "+className+" {\n");
+ buf.append(classBody);
+ buf.append("}\n");
+ String contents= buf.toString();
+
+ IPackageFragment basePkg = CompletionTestSetup.getAbsoluteTestPackage(basePackage);
+ basePkg.createCompilationUnit(className+".java", contents, true, null);
+ }
+
+ // from 3.4 AbstractCompletionTest:
+ protected static final String CARET= "|";
+
+ private ICompilationUnit fCU;
+ private JavaEditor fEditor;
+
+ private String fBeforeImports;
+ private String fAfterImports;
+ private String fMembers;
+ private String fLocals;
+ private char fTrigger;
+ private boolean fWaitBeforeCompleting;
+
+ protected void assertChoices(ICompletionProposal proposal, String[][] expected) {
+ assertTrue("Not a ParameterGuessingProposal", proposal instanceof ParameterGuessingProposal);
+ ParameterGuessingProposal pgProposal = (ParameterGuessingProposal)proposal;
+ ICompletionProposal[][] choices = new ProposalAdaptor().getChoices(pgProposal);
+ assertEquals("Not same number of choices", expected.length, choices.length);
+ for (int i=0; i<choices.length; i++) {
+ assertEquals("Not same number of nested choices", expected[i].length, choices[i].length);
+ for (int j=0; j<choices.length; j++) {
+ assertEquals("Unexpected choice", expected[i][j], choices[i][j].getDisplayString());
+ }
+ }
+ }
+
+ protected ICompletionProposal assertTypeBodyProposal(String before, String selector, String expected, int requiredRelevance)
+ throws CoreException
+ {
+ return assertTypeBodyProposal(before, selector, expected, requiredRelevance, true);
+ }
+ protected ICompletionProposal assertTypeBodyProposal(String before, String selector, String expected, int requiredRelevance, boolean addRole)
+ throws CoreException
+ {
+ StringBuffer contents= new StringBuffer();
+ IRegion preSelection= assembleClassBodyTestCUExtractSelection(contents, before, fBeforeImports, addRole);
+ StringBuffer result= new StringBuffer();
+ IRegion expectedSelection= assembleClassBodyTestCUExtractSelection(result, expected, fAfterImports, addRole);
+
+ return assertProposal(selector, null, null, contents, preSelection, result, expectedSelection, requiredRelevance);
+ }
+
+ protected ICompletionProposal assertROFIBodyProposal(String before, String selector, String expected, int requiredRelevance)
+ throws CoreException
+ {
+ IPackageFragment testPkg = CompletionTestSetup.getTestPackage(null);
+ String teamName = "Completion_" + getName();
+ testPkg.createCompilationUnit(teamName + ".java",
+ "package test1;\n" +
+ "/** @role RoFiRole */\n" +
+ "public team class Completion_"+getName()+" {}\n",
+ true, null);
+
+ StringBuffer contents= new StringBuffer();
+ IRegion preSelection= assembleROFIBodyTestCUExtractSelection(contents, before, fBeforeImports);
+ StringBuffer result= new StringBuffer();
+ IRegion expectedSelection= assembleROFIBodyTestCUExtractSelection(result, expected, fAfterImports);
+
+ return assertProposal(selector, teamName, "RoFiRole", contents, preSelection, result, expectedSelection, requiredRelevance);
+ }
+
+ protected void assertNosuchTypeBodyProposal(String before, String selector, int requiredRelevance)
+ throws CoreException
+ {
+ StringBuffer contents= new StringBuffer();
+ IRegion preSelection= assembleClassBodyTestCUExtractSelection(contents, before, fBeforeImports, true);
+
+ assertNosuchProposal(selector, contents, preSelection, requiredRelevance);
+ }
+
+ private IRegion assembleClassBodyTestCUExtractSelection(StringBuffer buffer, String javadocLine, String imports, boolean addRole) {
+ String prefix= "package test1;\n" +
+ imports +
+ "\n" +
+ "public team class Completion_" + getName() + " {\n" + // SH: added: team, removed <T> (crashed!!) FIXME!!
+//{ObjectTeams:
+ (addRole ?
+ " protected class R playedBy B {\n" : "") +
+// SH}
+ fLocals +
+ ""; // SH: removed blanks
+ String postfix= "\n" +
+ "\n" +
+ fMembers +
+//{ObjectTeams:
+ (addRole ?
+ " }\n":"")+
+// SH}
+ "}\n";
+ StringBuffer lineBuffer= new StringBuffer(javadocLine);
+ int firstPipe= lineBuffer.indexOf(CARET);
+ int secondPipe;
+ if (firstPipe == -1) {
+ firstPipe= lineBuffer.length();
+ secondPipe= firstPipe;
+ } else {
+ lineBuffer.replace(firstPipe, firstPipe + CARET.length(), "");
+ secondPipe= lineBuffer.indexOf(CARET, firstPipe);
+ if (secondPipe ==-1)
+ secondPipe= firstPipe;
+ else
+ lineBuffer.replace(secondPipe, secondPipe + CARET.length(), "");
+ }
+ buffer.append(prefix + lineBuffer + postfix);
+ return new Region(firstPipe + prefix.length(), secondPipe - firstPipe);
+ }
+
+ private IRegion assembleROFIBodyTestCUExtractSelection(StringBuffer buffer, String javadocLine, String imports) {
+ String teamName = "Completion_" + getName();
+ String prefix= "team package test1."+teamName+";\n" +
+ imports +
+ "\n" +
+ "protected class RoFiRole playedBy B {\n" +
+ fLocals +
+ "";
+ String postfix= "\n" +
+ "\n" +
+ fMembers +
+ "}\n";
+ StringBuffer lineBuffer= new StringBuffer(javadocLine);
+ int firstPipe= lineBuffer.indexOf(CARET);
+ int secondPipe;
+ if (firstPipe == -1) {
+ firstPipe= lineBuffer.length();
+ secondPipe= firstPipe;
+ } else {
+ lineBuffer.replace(firstPipe, firstPipe + CARET.length(), "");
+ secondPipe= lineBuffer.indexOf(CARET, firstPipe);
+ if (secondPipe ==-1)
+ secondPipe= firstPipe;
+ else
+ lineBuffer.replace(secondPipe, secondPipe + CARET.length(), "");
+ }
+ buffer.append(prefix + lineBuffer + postfix);
+ return new Region(firstPipe + prefix.length(), secondPipe - firstPipe);
+ }
+
+ private ICompletionProposal assertProposal(String selector, String relativePackage, String typeName, StringBuffer contents, IRegion preSelection, StringBuffer result, IRegion expectedSelection, int requiredRelevance) throws CoreException {
+//{ObjectTeams: made package and file name configurable via new arguments `relativePackage'/`typeName':
+ IPackageFragment pkg = (relativePackage == null) ? CompletionTestSetup.getAnonymousTestPackage() : CompletionTestSetup.getTestPackage(relativePackage);
+ fCU= (typeName == null) ? createCU(pkg, contents.toString()) : pkg.createCompilationUnit(typeName + ".java", contents.toString(), false, null);
+// SH}
+ fEditor= (JavaEditor) EditorUtility.openInEditor(fCU);
+ IDocument doc;
+ ITextSelection postSelection;
+ ICompletionProposal proposal = null;
+ try {
+ proposal= findNonNullProposal(selector, fCU, preSelection, requiredRelevance);
+ doc= fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput());
+//{ObjectTeams: selection needs to be set in the editor:
+ fEditor.getSelectionProvider().setSelection(new TextSelection(preSelection.getOffset(), preSelection.getLength()));
+// SH}
+ apply(fEditor, doc, proposal, preSelection);
+ postSelection= (ITextSelection) fEditor.getSelectionProvider().getSelection();
+ } finally {
+ JavaProjectHelper.emptyDisplayLoop();
+ closeEditor(fEditor);
+ }
+
+ assertEquals(result.toString(), doc.get());
+ assertEquals("selection offset", expectedSelection.getOffset(), postSelection.getOffset());
+ assertEquals("selection length", expectedSelection.getLength(), postSelection.getLength());
+ return proposal;
+ }
+
+ private void assertNosuchProposal(String selector, StringBuffer contents, IRegion preSelection, int requiredRelevance)
+ throws CoreException
+ {
+ fCU= createCU(CompletionTestSetup.getAnonymousTestPackage(), contents.toString());
+ fEditor= (JavaEditor) EditorUtility.openInEditor(fCU);
+ try {
+ ICompletionProposal proposal= findNamedProposal(selector, fCU, preSelection, requiredRelevance);
+ assertNull("found unexpected proposal: "+selector, proposal);
+ } finally {
+ closeEditor(fEditor);
+ }
+ }
+
+ // from 3.4 CodeCompletionTest
+ private void assertAppliedProposal(String contents, IJavaCompletionProposal proposal, String completion) {
+ IDocument doc= new Document(contents);
+ proposal.apply(doc);
+ int offset2= contents.indexOf("//here");
+ String result= contents.substring(0, offset2) + completion + contents.substring(offset2);
+ assertEquals(result, doc.get());
+ }
+
+ private ICompilationUnit createCU(IPackageFragment pack1, String contents) throws JavaModelException {
+ ICompilationUnit cu= pack1.createCompilationUnit("Completion_" + getName() + ".java", contents, false, null);
+ return cu;
+ }
+
+ private ICompletionProposal findNonNullProposal(String prefix, ICompilationUnit cu, IRegion selection, int requiredRelevance) throws JavaModelException, PartInitException {
+ ICompletionProposal proposal= findNamedProposal(prefix, cu, selection, requiredRelevance);
+ assertNotNull("no proposal starting with \"" + prefix + "\"", proposal);
+ return proposal;
+ }
+
+ private ICompletionProposal findNamedProposal(String prefix, ICompilationUnit cu, IRegion selection, int requiredRelevance) throws JavaModelException, PartInitException {
+ ICompletionProposal[] proposals= collectProposals(cu, selection);
+
+ ICompletionProposal found= null;
+ for (int i= 0; i < proposals.length; i++) {
+ if (proposals[i] instanceof IJavaCompletionProposal)
+ if (((IJavaCompletionProposal)proposals[i]).getRelevance() < requiredRelevance)
+ continue;
+ String displayString= proposals[i].getDisplayString();
+ if (displayString.startsWith(prefix)) {
+ if (found == null || displayString.equals(prefix))
+ found= proposals[i];
+ }
+ }
+ return found;
+ }
+
+ private ICompletionProposal[] collectProposals(ICompilationUnit cu, IRegion selection) throws JavaModelException, PartInitException {
+ waitBeforeCoreCompletion();
+ ContentAssistant assistant= new ContentAssistant();
+ assistant.setDocumentPartitioning(IJavaPartitions.JAVA_PARTITIONING);
+ IContentAssistProcessor javaProcessor= new JavaCompletionProcessor(fEditor, assistant, getContentType());
+
+ ICompletionProposal[] proposals= javaProcessor.computeCompletionProposals(fEditor.getViewer(), selection.getOffset());
+ return proposals;
+ }
+
+ /**
+ * Invokes {@link Thread#sleep(long)} if {@link #waitBeforeCompleting(boolean)} was set to
+ * <code>true</code> or camel case completions are enabled. For some reasons, inner types and
+ * camel case matches don't show up otherwise.
+ *
+ * @since 3.2
+ */
+ private void waitBeforeCoreCompletion() {
+ if (fWaitBeforeCompleting || JavaCore.ENABLED.equals(JavaCore.getOption(JavaCore.CODEASSIST_CAMEL_CASE_MATCH))) {
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException x) {
+ }
+ }
+ }
+
+ protected String getContentType() {
+ return IDocument.DEFAULT_CONTENT_TYPE;
+ }
+
+ private void apply(ITextEditor editor, IDocument doc, ICompletionProposal proposal, IRegion selection) {
+ if (proposal instanceof ICompletionProposalExtension2) {
+ ICompletionProposalExtension2 ext= (ICompletionProposalExtension2) proposal;
+ ITextViewer viewer= (ITextViewer) editor.getAdapter(ITextOperationTarget.class);
+ ext.selected(viewer, false);
+ viewer.setSelectedRange(selection.getOffset(), selection.getLength());
+ ext.apply(viewer, fTrigger, 0, selection.getOffset());
+ Point range= proposal.getSelection(doc);
+ if (range != null)
+ viewer.setSelectedRange(range.x, range.y);
+ } else if (proposal instanceof ICompletionProposalExtension) {
+ ICompletionProposalExtension ext= (ICompletionProposalExtension) proposal;
+ ext.apply(doc, fTrigger, selection.getOffset() + selection.getLength());
+ } else {
+ proposal.apply(doc);
+ }
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CompletionTestSetup.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CompletionTestSetup.java
new file mode 100644
index 000000000..76bb75985
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/CompletionTestSetup.java
@@ -0,0 +1,77 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: CompletionTestSetup.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.core;
+
+import junit.framework.Test;
+
+import org.eclipse.core.runtime.CoreException;
+
+import org.eclipse.jdt.ui.tests.core.ProjectTestSetup;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.testplugin.JavaProjectHelper;
+
+/*
+ * Copied from org.eclipse.jdt.text.tests (Version 3.4 as of Mar 07, 2008)
+ */
+class CompletionTestSetup extends ProjectTestSetup {
+
+ // SH: added parameter
+ public static IPackageFragment getTestPackage(String relativeName) throws CoreException {
+ String packageName = "test1";
+ if (relativeName != null)
+ packageName += '.'+relativeName;
+ return getAbsoluteTestPackage(packageName);
+ }
+ public static IPackageFragment getAbsoluteTestPackage(String packageName) throws CoreException {
+ IJavaProject project= getProject();
+ IPackageFragmentRoot root= project.getPackageFragmentRoot("src");
+ if (!root.exists())
+ root= JavaProjectHelper.addSourceContainer(project, "src");
+
+ IPackageFragment fragment= root.getPackageFragment(packageName);
+ if (!fragment.exists())
+ fragment= root.createPackageFragment(packageName, false, null);
+
+ return fragment;
+ }
+
+ private static int fAnonymousSoureFolderCounter= 0;
+ public static IPackageFragment getAnonymousTestPackage() throws CoreException {
+ IJavaProject project= getProject();
+ String sourceFolder= "src" + fAnonymousSoureFolderCounter++;
+ IPackageFragmentRoot root= project.getPackageFragmentRoot(sourceFolder);
+ if (!root.exists())
+ root= JavaProjectHelper.addSourceContainer(project, sourceFolder);
+
+ IPackageFragment fragment= root.getPackageFragment("test1");
+ if (!fragment.exists())
+ fragment= root.createPackageFragment("test1", false, null);
+
+ return fragment;
+ }
+
+ public CompletionTestSetup(Test test) {
+ super(test);
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ModifierCorrectionsQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ModifierCorrectionsQuickFixTest.java
new file mode 100644
index 000000000..1bc7ecff0
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ModifierCorrectionsQuickFixTest.java
@@ -0,0 +1,420 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.core;
+
+import java.util.ArrayList;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.internal.ui.text.correction.proposals.CUCorrectionProposal;
+
+/**
+ * Test OT-specific quickfixes (here: modifier corrections).
+ * @author stephan
+ * @since 1.2.1
+ */
+// structure OT_COPY_PASTE from {@link org.eclipse.jdt.ui.tests.quickfix.ModifierCorrectionsQuickFixTest}
+public class ModifierCorrectionsQuickFixTest extends OTQuickFixTest {
+
+
+ private static final Class THIS= ModifierCorrectionsQuickFixTest.class;
+
+
+ public ModifierCorrectionsQuickFixTest(String name) {
+ super(name);
+ }
+
+ public static Test allTests() {
+ return setUpTest(new TestSuite(THIS));
+ }
+
+ public static Test setUpTest(Test test) {
+ return new ProjectTestSetup(test);
+ }
+
+ public static Test suite() {
+ return allTests();
+ }
+
+
+ /* calling a non-public role constructor from the team. */
+ public void testRoleCtorCalled1() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R {\n");
+ buf.append(" R(){}\n");
+ buf.append(" }\n");
+ buf.append(" void foo() {\n");
+ buf.append(" R r = new R();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 1);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R {\n");
+ buf.append(" protected R(){}\n");
+ buf.append(" }\n");
+ buf.append(" void foo() {\n");
+ buf.append(" R r = new R();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ /* calling a non-public role constructor from a sibling role. */
+ public void testRoleCtorCalled2() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R {\n");
+ buf.append(" R(){}\n");
+ buf.append(" }\n");
+ buf.append(" protected class R2 {\n");
+ buf.append(" void foo() {\n");
+ buf.append(" R r = new R();\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 1);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R {\n");
+ buf.append(" protected R(){}\n");
+ buf.append(" }\n");
+ buf.append(" protected class R2 {\n");
+ buf.append(" void foo() {\n");
+ buf.append(" R r = new R();\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ /* calling a non-public role constructor from a sibling role file. */
+ public void testRoleCtorCalled3() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ IPackageFragment pack1T= fSourceFolder.createPackageFragment("test1.T", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R {\n");
+ buf.append(" R(){}\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("team package test1.T;\n");
+ buf.append("protected class R2 {\n");
+ buf.append(" void foo() {\n");
+ buf.append(" R r = new R();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1T.createCompilationUnit("R2.java", buf.toString(), false, null);
+
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 1);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R {\n");
+ buf.append(" protected R(){}\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ /* a non-public constructor of a role file is called from a sibling role. */
+ public void testRoleCtorCalled4() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ IPackageFragment pack1T= fSourceFolder.createPackageFragment("test1.T", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("team package test1.T;\n");
+ buf.append("protected class R2 {\n");
+ buf.append(" R2(){}\n");
+ buf.append("}\n");
+ pack1T.createCompilationUnit("R2.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R {\n");
+ buf.append(" void foo() {\n");
+ buf.append(" R2 r = new R2();\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 1);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("team package test1.T;\n");
+ buf.append("protected class R2 {\n");
+ buf.append(" protected R2(){}\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ /* calling a non-public role constructor as externalized. */
+ public void testRoleCtorCalled5() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" public class R {\n");
+ buf.append(" R(){}\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class Main {\n");
+ buf.append(" void foo(final T t) {\n");
+ buf.append(" R<@t> r = t.new R();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("Main.java", buf.toString(), false, null);
+
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot, 2, null);
+ assertNumberOfProposals(proposals, 1);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" public class R {\n");
+ buf.append(" public R(){}\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ /* calling a non-public role method on externalized. */
+ public void testRoleMethodCalled() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" public class R {\n");
+ buf.append(" void bar(){}\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class Main {\n");
+ buf.append(" void foo(final T t, R<@t> r) {\n");
+ buf.append(" r.bar();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("Main.java", buf.toString(), false, null);
+
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 1);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T {\n");
+ buf.append(" public class R {\n");
+ buf.append(" public void bar(){}\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testCalloutToPrivate() throws Exception {
+ IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class BaseBar {\n");
+ buf.append(" private int foo() { return 0; }\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("BaseBar.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class TeamFoo {\n");
+ buf.append(" protected class R playedBy BaseBar {\n");
+ buf.append(" @SuppressWarnings(\"decapsulation\")\n");
+ buf.append(" int goo() -> int foo();\n");
+ buf.append(" }\n");
+ buf.append(" void t(R r) {\n");
+ buf.append(" int j = r.goo();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("TeamFoo.java", buf.toString(), false, null);
+
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 1);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class TeamFoo {\n");
+ buf.append(" protected class R playedBy BaseBar {\n");
+ buf.append(" @SuppressWarnings(\"decapsulation\")\n");
+ buf.append(" protected\n");
+ buf.append(" int goo() -> int foo();\n");
+ buf.append(" }\n");
+ buf.append(" void t(R r) {\n");
+ buf.append(" int j = r.goo();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+
+ public void testCalloutViaExternalized() throws Exception {
+ IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class BaseBar {\n");
+ buf.append(" int foo() { return 0; }\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("BaseBar.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class TeamFoo {\n");
+ buf.append(" public class R playedBy BaseBar {\n");
+ buf.append(" int goo() -> int foo();\n");
+ buf.append(" }\n");
+ buf.append(" void t(final TeamFoo t, R<@t> r) {\n");
+ buf.append(" int j = r.goo();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("TeamFoo.java", buf.toString(), false, null);
+
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 1);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class TeamFoo {\n");
+ buf.append(" public class R playedBy BaseBar {\n");
+ buf.append(" public int goo() -> int foo();\n");
+ buf.append(" }\n");
+ buf.append(" void t(final TeamFoo t, R<@t> r) {\n");
+ buf.append(" int j = r.goo();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ /** @SuppressWarnings("bindingconventions") was added a wrong location. */
+ public void testSuppressWarnings1() throws Exception {
+ IPackageFragment pack1 = fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class BaseBar {\n");
+ buf.append(" int foo() { return 0; }\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("BaseBar.java", buf.toString(), false, null);
+
+ IPackageFragment pack2 = fSourceFolder.createPackageFragment("test2", false, null);
+ buf = new StringBuffer();
+ buf.append("package test2;\n");
+ buf.append("import test1.BaseBar;\n");
+ buf.append("public team class TeamFoo {\n");
+ buf.append(" public class R playedBy BaseBar {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack2.createCompilationUnit("TeamFoo.java", buf.toString(), false, null);
+
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 2);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test2;\n");
+ buf.append("import test1.BaseBar;\n");
+ buf.append("public team class TeamFoo {\n");
+ buf.append(" @SuppressWarnings(\"bindingconventions\")\n");
+ buf.append(" public class R playedBy BaseBar {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTJavadocQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTJavadocQuickFixTest.java
new file mode 100644
index 000000000..c475b0154
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTJavadocQuickFixTest.java
@@ -0,0 +1,155 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: OTJavadocQuickFixTest.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.core;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
+import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
+import org.eclipse.jdt.internal.corext.template.java.CodeTemplateContextType;
+import org.eclipse.jdt.internal.ui.text.correction.proposals.CUCorrectionProposal;
+import org.eclipse.jdt.testplugin.TestOptions;
+import org.eclipse.objectteams.otdt.ui.tests.util.JavaProjectHelper;
+
+/**
+ * largely inspired by org.eclipse.jdt.ui.tests.quickfix.JavadocQuickFixTest.
+ * @author stephan
+ * @since 1.2.5
+ */
+public class OTJavadocQuickFixTest extends OTQuickFixTest {
+
+ private static final Class THIS= OTJavadocQuickFixTest.class;
+
+ public OTJavadocQuickFixTest(String name) {
+ super(name);
+ }
+
+ public static Test allTests() {
+ return setUpTest(new TestSuite(THIS));
+ }
+
+ public static Test setUpTest(Test test) {
+ return new ProjectTestSetup(test);
+ }
+
+ public static Test suite() {
+ return allTests();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void setUp() throws Exception {
+ Hashtable options= TestOptions.getDefaultOptions();
+ options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
+ options.put(JavaCore.COMPILER_PB_INVALID_JAVADOC, JavaCore.ERROR);
+ options.put(JavaCore.COMPILER_PB_INVALID_JAVADOC_TAGS, JavaCore.ENABLED);
+ options.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS, JavaCore.ERROR);
+ options.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS, JavaCore.ERROR);
+ options.put(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS_OVERRIDING, JavaCore.ENABLED);
+ JavaCore.setOptions(options);
+
+ StringBuffer comment= new StringBuffer();
+ comment.append("/**\n");
+ comment.append(" * A comment.\n");
+ comment.append(" * ${tags}\n");
+ comment.append(" */");
+ String res= comment.toString();
+ StubUtility.setCodeTemplate(CodeTemplateContextType.CONSTRUCTORCOMMENT_ID, res, null);
+ StubUtility.setCodeTemplate(CodeTemplateContextType.METHODCOMMENT_ID, res, null);
+ StubUtility.setCodeTemplate(CodeTemplateContextType.TYPECOMMENT_ID, res, null);
+
+ comment= new StringBuffer();
+ comment.append("/**\n");
+ comment.append(" * A field comment for ${field}.\n");
+ comment.append(" */");
+ StubUtility.setCodeTemplate(CodeTemplateContextType.FIELDCOMMENT_ID, comment.toString(), null);
+
+ comment= new StringBuffer();
+ comment.append("/**\n");
+ comment.append(" * A override comment.\n");
+ comment.append(" * ${see_to_overridden}\n");
+ comment.append(" */");
+ StubUtility.setCodeTemplate(CodeTemplateContextType.OVERRIDECOMMENT_ID, comment.toString(), null);
+
+ comment= new StringBuffer();
+ comment.append("/**\n");
+ comment.append(" * A delegate comment.\n");
+ comment.append(" * ${see_to_target}\n");
+ comment.append(" */");
+ StubUtility.setCodeTemplate(CodeTemplateContextType.DELEGATECOMMENT_ID, comment.toString(), null);
+
+ fJProject1= ProjectTestSetup.getProject();
+
+ fSourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src");
+
+//{ObjectTeams: add the OTRE:
+ JavaProjectHelper.addLibrary(fJProject1, new Path(OTRE_JAR_PATH));
+// SH}
+ }
+
+ public void testMissingRoleTag1() throws Exception {
+ IPackageFragment teamPkg = fSourceFolder.createPackageFragment("test1.MyTeam", false, null);
+ teamPkg.createCompilationUnit("MyRole.java",
+ "team package test1.MyTeam;\n" +
+ "public class MyRole {}\n",
+ true, null);
+
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("/**\n");
+ buf.append(" */\n");
+ buf.append("public team class MyTeam {\n");
+ buf.append(" private MyRole r = null;\n"); // use field to trigger loading of role file
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("MyTeam.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot, 1);
+ assertNumberOfProposals(proposals, 1);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview1= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("/**\n");
+ buf.append(" * @role MyRole\n");
+ buf.append(" */\n");
+ buf.append("public team class MyTeam {\n");
+ buf.append(" private MyRole r = null;\n");
+ buf.append("}\n");
+ String expected= buf.toString();
+ assertEqualString(preview1, expected);
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTQuickFixTest.java
new file mode 100644
index 000000000..dbe255307
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OTQuickFixTest.java
@@ -0,0 +1,92 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: OTQuickFixTest.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.core;
+
+import java.io.File;
+import java.util.Hashtable;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
+import org.eclipse.jdt.testplugin.JavaProjectHelper;
+import org.eclipse.jdt.testplugin.TestOptions;
+import org.eclipse.jdt.ui.tests.quickfix.QuickFixTest;
+import org.eclipse.objectteams.otdt.core.ext.OTDTPlugin;
+
+public class OTQuickFixTest extends QuickFixTest {
+
+ protected IJavaProject fJProject1;
+
+ protected IPackageFragmentRoot fSourceFolder;
+
+ public OTQuickFixTest(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite= new TestSuite();
+ suite.addTest(ModifierCorrectionsQuickFixTest.suite());
+ suite.addTest(CalloutQuickFixTest.suite());
+ suite.addTest(CallinQuickFixTest.suite());
+ suite.addTest(UnresolvedMethodsQuickFixTest.suite());
+ suite.addTest(OTJavadocQuickFixTest.suite());
+
+ return suite;
+ }
+
+ public static final String OT_RUNTIME_PATH;
+ public static final String OTRE_JAR_PATH;
+ static {
+ OT_RUNTIME_PATH = JavaCore.getClasspathVariable(OTDTPlugin.OTDT_INSTALLDIR).toOSString();
+ OTRE_JAR_PATH = OT_RUNTIME_PATH
+ + File.separator
+ + "lib" //$NON-NLS-1$
+ + File.separator
+ + "otre.jar"; //$NON-NLS-1$
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void addOptions(Hashtable options) {
+ options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, JavaCore.SPACE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
+ options.put(JavaCore.COMPILER_PB_STATIC_ACCESS_RECEIVER, JavaCore.ERROR);
+ }
+
+ protected void setUp() throws Exception {
+ Hashtable options= TestOptions.getDefaultOptions();
+ addOptions(options);
+
+ JavaCore.setOptions(options);
+
+ fJProject1= ProjectTestSetup.getProject();
+
+ fSourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src");
+ }
+
+ protected void tearDown() throws Exception {
+ JavaProjectHelper.clear(fJProject1, ProjectTestSetup.getDefaultClasspath());
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OrganizeImportsTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OrganizeImportsTest.java
new file mode 100644
index 000000000..54989d3d9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/OrganizeImportsTest.java
@@ -0,0 +1,836 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: OrganizeImportsTest.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.core;
+
+import java.util.Hashtable;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
+import org.eclipse.jdt.core.search.TypeNameMatch;
+import org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation;
+import org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.IChooseImportQuery;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jdt.ui.PreferenceConstants;
+import org.eclipse.objectteams.otdt.core.ext.OTREContainer;
+import org.eclipse.objectteams.otdt.ui.tests.util.JavaProjectHelper;
+import org.eclipse.objectteams.otdt.ui.tests.util.TestOptions;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ * This class contains tests that have been copied from the original class
+ * <code>org.eclipse.jdt.ui.tests.core.ImportOrganizeTest</code> in the test suite
+ * <code>org.eclipse.jdt.ui.tests.refactoring</code> provided by Eclipse as
+ * well as new OT-specific tests.
+ *
+ * @author brcan
+ */
+@SuppressWarnings("restriction")
+public class OrganizeImportsTest extends TestCase
+{
+ private IJavaProject _project;
+
+ public OrganizeImportsTest(String name)
+ {
+ super(name);
+ }
+
+ public static Test allTests()
+ {
+ return new ProjectTestSetup(new TestSuite(OrganizeImportsTest.class));
+ }
+
+ public static Test suite()
+ {
+ if (true)
+ {
+ return allTests();
+ }
+ else
+ {
+ TestSuite suite = new TestSuite();
+ suite.addTest(new OrganizeImportsTest("testVisibility_bug56704"));
+ return new ProjectTestSetup(suite);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception
+ {
+ _project = ProjectTestSetup.getProject();
+
+ Hashtable options = TestOptions.getFormatterOptions();
+ options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE,
+ String.valueOf(99));
+ JavaCore.setOptions(options);
+ }
+
+ protected void tearDown() throws Exception
+ {
+ JavaProjectHelper.clear(_project, ProjectTestSetup.getDefaultClasspath());
+ OTREContainer.initializeOTJProject(_project.getProject());
+ }
+
+ private IChooseImportQuery createQuery(
+ final String name,
+ final String[] choices,
+ final int[] nEntries)
+ {
+ return new IChooseImportQuery() {
+ public TypeNameMatch[] chooseImports(TypeNameMatch[][] openChoices, ISourceRange[] ranges)
+ {
+ assertTrue(
+ name + "-query-nchoices1",
+ choices.length == openChoices.length);
+ assertTrue(
+ name + "-query-nchoices2",
+ nEntries.length == openChoices.length);
+ if (nEntries != null)
+ {
+ for (int i = 0; i < nEntries.length; i++)
+ {
+ assertTrue(
+ name + "-query-cnt" + i,
+ openChoices[i].length == nEntries[i]);
+ }
+ }
+ TypeNameMatch[] res = new TypeNameMatch[openChoices.length];
+ for (int i = 0; i < openChoices.length; i++)
+ {
+ TypeNameMatch[] selection = openChoices[i];
+ assertNotNull(name + "-query-setset" + i, selection);
+ assertTrue(name + "-query-setlen" + i, selection.length > 0);
+ TypeNameMatch found = null;
+ for (int k = 0; k < selection.length; k++)
+ {
+ if (selection[k].getFullyQualifiedName().equals(choices[i]))
+ {
+ found = selection[k];
+ }
+ }
+ assertNotNull(name + "-query-notfound" + i, found);
+ res[i] = found;
+ }
+ return res;
+ }
+ };
+ }
+
+ public static void assertEqualString(String actual, String expected)
+ {
+ StringAsserts.assertEqualString(actual, expected);
+ }
+
+ //OT-specific tests
+ public void testTypeReferenceInRoleclass1() throws Exception
+ {
+ IPackageFragmentRoot sourceFolder = JavaProjectHelper
+ .addSourceContainer(_project, "src");
+
+ IPackageFragment basePkg = sourceFolder.createPackageFragment(
+ "basePkg",
+ false,
+ null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package basePkg;\n");
+ buf.append("public class B1 {\n");
+ buf.append("}\n");
+ basePkg.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ IPackageFragment teamPkg = sourceFolder.createPackageFragment(
+ "teamPkg",
+ false,
+ null);
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 playedBy B1 {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu = teamPkg.createCompilationUnit("T1.java", buf
+ .toString(), false, null);
+
+ String[] order = new String[0];
+ IChooseImportQuery query = createQuery(
+ "T1",
+ new String[] {},
+ new int[] {});
+
+ OrganizeImportsOperation op = createOperation(cu, order,
+ 99, false, true, true, query);
+ op.run(null);
+
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("\n");
+ buf.append("import base basePkg.B1;\n");
+ buf.append("\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 playedBy B1 {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(cu.getSource(), buf.toString());
+ }
+
+ public void testTypeReferenceInRoleclass2() throws Exception
+ {
+ IPackageFragmentRoot sourceFolder = JavaProjectHelper
+ .addSourceContainer(_project, "src");
+
+ IPackageFragment basePkg = sourceFolder.createPackageFragment(
+ "basePkg",
+ false,
+ null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package basePkg;\n");
+ buf.append("public class B1 {\n");
+ buf.append("}\n");
+ basePkg.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ buf = new StringBuffer();
+ buf.append("package basePkg;\n");
+ buf.append("public class B2 {\n");
+ buf.append("}\n");
+ basePkg.createCompilationUnit("B2.java", buf.toString(), false, null);
+
+ IPackageFragment teamPkg = sourceFolder.createPackageFragment(
+ "teamPkg",
+ false,
+ null);
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 playedBy B1 {\n");
+ buf.append(" }\n");
+ buf.append(" public class R2 playedBy B2 {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu = teamPkg.createCompilationUnit("T1.java", buf
+ .toString(), false, null);
+
+ String[] order = new String[0];
+ IChooseImportQuery query = createQuery(
+ "T1",
+ new String[] {},
+ new int[] {});
+
+ OrganizeImportsOperation op = createOperation(cu, order,
+ 99, false, true, true, query);
+ op.run(null);
+
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("\n");
+ buf.append("import base basePkg.B1;\n");
+ buf.append("import base basePkg.B2;\n");
+ buf.append("\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 playedBy B1 {\n");
+ buf.append(" }\n");
+ buf.append(" public class R2 playedBy B2 {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(cu.getSource(), buf.toString());
+ }
+
+ public void testTypeReferenceInRoleclass3() throws Exception
+ {
+ IPackageFragmentRoot sourceFolder = JavaProjectHelper
+ .addSourceContainer(_project, "src");
+
+ IPackageFragment basePkg = sourceFolder.createPackageFragment(
+ "basePkg",
+ false,
+ null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package basePkg;\n");
+ buf.append("public class B1 {\n");
+ buf.append("}\n");
+ basePkg.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ IPackageFragment teamPkg = sourceFolder.createPackageFragment(
+ "teamPkg",
+ false,
+ null);
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 {\n");
+ buf.append(" callin void rm1(B1 b1) {\n");
+ buf.append(" base.rm1(b1);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu = teamPkg.createCompilationUnit("T1.java", buf
+ .toString(), false, null);
+
+ String[] order = new String[0];
+ IChooseImportQuery query = createQuery(
+ "T1",
+ new String[] {},
+ new int[] {});
+
+ OrganizeImportsOperation op = createOperation(cu, order,
+ 99, false, true, true, query);
+ op.run(null);
+
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("\n");
+ buf.append("import basePkg.B1;\n");
+ buf.append("\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 {\n");
+ buf.append(" callin void rm1(B1 b1) {\n");
+ buf.append(" base.rm1(b1);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(cu.getSource(), buf.toString());
+ }
+
+ public void testTypeReferenceInRoleclass4() throws Exception
+ {
+ IPackageFragmentRoot sourceFolder = JavaProjectHelper
+ .addSourceContainer(_project, "src");
+
+ IPackageFragment basePkg = sourceFolder.createPackageFragment(
+ "basePkg",
+ false,
+ null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package basePkg;\n");
+ buf.append("public class B1 {\n");
+ buf.append(" public void setBase(B1 b1) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ basePkg.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ IPackageFragment teamPkg = sourceFolder.createPackageFragment(
+ "teamPkg",
+ false,
+ null);
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 playedBy B1 {\n");
+ buf.append(" void setBase(B1 b1) -> void setBase(B1 b1);\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu = teamPkg.createCompilationUnit("T1.java", buf
+ .toString(), false, null);
+
+ String[] order = new String[0];
+ IChooseImportQuery query = createQuery(
+ "T1",
+ new String[] {},
+ new int[] {});
+
+ OrganizeImportsOperation op = createOperation(cu, order,
+ 99, false, true, true, query);
+ op.run(null);
+
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("\n");
+ buf.append("import base basePkg.B1;\n");
+ buf.append("\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 playedBy B1 {\n");
+ buf.append(" void setBase(B1 b1) -> void setBase(B1 b1);\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(cu.getSource(), buf.toString());
+ }
+
+ public void testTypeReferenceInRoleclass5() throws Exception
+ {
+ IPackageFragmentRoot sourceFolder = JavaProjectHelper
+ .addSourceContainer(_project, "src");
+
+ IPackageFragment basePkg = sourceFolder.createPackageFragment(
+ "basePkg",
+ false,
+ null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package basePkg;\n");
+ buf.append("public team class T2 {\n");
+ buf.append("}\n");
+ basePkg.createCompilationUnit("T2.java", buf.toString(), false, null);
+
+ IPackageFragment teamPkg = sourceFolder.createPackageFragment(
+ "teamPkg",
+ false,
+ null);
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 playedBy T2 {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu = teamPkg.createCompilationUnit("T1.java", buf
+ .toString(), false, null);
+
+ String[] order = new String[0];
+ IChooseImportQuery query = createQuery(
+ "T1",
+ new String[] {},
+ new int[] {});
+
+ OrganizeImportsOperation op = createOperation(cu, order,
+ 99, false, true, true, query);
+ op.run(null);
+
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("\n");
+ buf.append("import base basePkg.T2;\n");
+ buf.append("\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 playedBy T2 {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(cu.getSource(), buf.toString());
+ }
+ /** playedBy inner base class - role and base have same name. */
+ public void testTypeReferenceInRoleclass6() throws Exception
+ {
+ IPackageFragmentRoot sourceFolder = JavaProjectHelper
+ .addSourceContainer(_project, "src");
+
+ IPackageFragment basePkg = sourceFolder.createPackageFragment(
+ "basePkg",
+ false,
+ null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package basePkg;\n");
+ buf.append("public class B1 {\n");
+ buf.append(" public class Inner {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ basePkg.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ IPackageFragment teamPkg = sourceFolder.createPackageFragment(
+ "teamPkg",
+ false,
+ null);
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("import base basePkg.B1;\n");
+ buf.append("import base basePkg.B1.Inner;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class Inner playedBy Inner {\n");
+ buf.append(" }\n");
+ buf.append(" protected class R0 playedBy B1 {\n");
+ buf.append(" Inner other;\n");
+ buf.append(" };\n");
+ buf.append("}\n");
+ ICompilationUnit cu = teamPkg.createCompilationUnit("T1.java", buf
+ .toString(), false, null);
+
+ String[] order = new String[0];
+ IChooseImportQuery query = createQuery(
+ "T1",
+ new String[] {},
+ new int[] {});
+
+ OrganizeImportsOperation op = createOperation(cu, order,
+ 99, false, true, true, query);
+ op.run(null);
+
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("import base basePkg.B1;\n");
+ buf.append("import base basePkg.B1.Inner;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class Inner playedBy Inner {\n");
+ buf.append(" }\n");
+ buf.append(" protected class R0 playedBy B1 {\n");
+ buf.append(" Inner other;\n");
+ buf.append(" };\n");
+ buf.append("}\n");
+ assertEqualString(cu.getSource(), buf.toString());
+ }
+
+ // base import for role file
+ public void testTypeReferenceInRoleclass7() throws Exception
+ {
+ IPackageFragmentRoot sourceFolder = JavaProjectHelper
+ .addSourceContainer(_project, "src");
+
+ IPackageFragment basePkg = sourceFolder.createPackageFragment(
+ "basePkg",
+ false,
+ null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package basePkg;\n");
+ buf.append("public class B1 {\n");
+ buf.append("}\n");
+ basePkg.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ IPackageFragment aspectPkg = sourceFolder.createPackageFragment(
+ "teamPkg",
+ false,
+ null);
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("public team class T1 {\n");
+ buf.append("}\n");
+ ICompilationUnit cu = aspectPkg.createCompilationUnit("T1.java", buf
+ .toString(), false, null);
+
+ // create the role file:
+ IPackageFragment teamPkg = sourceFolder.createPackageFragment(
+ "teamPkg.T1",
+ false,
+ null);
+ buf = new StringBuffer();
+ buf.append("team package teamPkg.T1;\n");
+ buf.append("public class R1 playedBy B1 {\n");
+ buf.append("}\n");
+ teamPkg.createCompilationUnit("R1.java", buf.toString(), false, null);
+
+ String[] order = new String[0];
+ IChooseImportQuery query = createQuery(
+ "T1",
+ new String[] {},
+ new int[] {});
+
+ OrganizeImportsOperation op = createOperation(cu, order,
+ 99, false, true, true, query);
+ op.run(null);
+
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("\n");
+ buf.append("import base basePkg.B1;\n");
+ buf.append("\n");
+ buf.append("public team class T1 {\n");
+ buf.append("}\n");
+ assertEqualString(cu.getSource(), buf.toString());
+ }
+
+ public void testCalloutToStatic() throws Exception
+ {
+ IPackageFragmentRoot sourceFolder = JavaProjectHelper
+ .addSourceContainer(_project, "src");
+
+ IPackageFragment basePkg = sourceFolder.createPackageFragment(
+ "basePkg",
+ false,
+ null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package basePkg;\n");
+ buf.append("public class B1 {\n");
+ buf.append(" private static void testB1() { }");
+ buf.append("}\n");
+ basePkg.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ IPackageFragment teamPkg = sourceFolder.createPackageFragment(
+ "teamPkg",
+ false,
+ null);
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 playedBy B1 {\n");
+ buf.append(" abstract static void test();");
+ buf.append(" void test() -> void testB1();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu = teamPkg.createCompilationUnit("T1.java", buf
+ .toString(), false, null);
+
+ String[] order = new String[0];
+ IChooseImportQuery query = createQuery(
+ "T1",
+ new String[] {},
+ new int[] {});
+
+ OrganizeImportsOperation op = createOperation(cu, order,
+ 99, false, true, true, query);
+ op.run(null);
+
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("\n");
+ buf.append("import base basePkg.B1;\n");
+ buf.append("\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 playedBy B1 {\n");
+ buf.append(" abstract static void test();");
+ buf.append(" void test() -> void testB1();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(cu.getSource(), buf.toString());
+
+ // invoke a second time to produce https://svn.objectteams.org/trac/ot/ticket/2
+ op = createOperation(cu, order,
+ 99, false, true, true, query);
+ op.run(null);
+ assertEqualString(cu.getSource(), buf.toString());
+ }
+
+ public void testStaticImportInGuard1() throws CoreException, BackingStoreException {
+ IPackageFragmentRoot sourceFolder = JavaProjectHelper
+ .addSourceContainer(_project, "src");
+
+ IPackageFragment basePkg = sourceFolder.createPackageFragment(
+ "basePkg",
+ false,
+ null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package basePkg;\n");
+ buf.append("public class B1 {\n");
+ buf.append(" private static void testB1() { }");
+ buf.append("}\n");
+ basePkg.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ IPackageFragment teamPkg = sourceFolder.createPackageFragment(
+ "teamPkg",
+ false,
+ null);
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("import static java.lang.Math.max;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 playedBy B1 when (max(1,2)==2) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu = teamPkg.createCompilationUnit("T1.java", buf
+ .toString(), false, null);
+
+ String[] order = new String[0];
+ IChooseImportQuery query = createQuery(
+ "T1",
+ new String[] {},
+ new int[] {});
+
+ OrganizeImportsOperation op = createOperation(cu, order,
+ 99, false, true, true, query);
+ op.run(null);
+
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("import static java.lang.Math.max;\n");
+ buf.append("import base basePkg.B1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 playedBy B1 when (max(1,2)==2) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(cu.getSource(), buf.toString());
+ }
+
+ public void testStaticImportInGuard2() throws CoreException, BackingStoreException {
+ IPackageFragmentRoot sourceFolder = JavaProjectHelper
+ .addSourceContainer(_project, "src");
+
+ IPackageFragment basePkg = sourceFolder.createPackageFragment(
+ "basePkg",
+ false,
+ null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package basePkg;\n");
+ buf.append("public class B1 {\n");
+ buf.append(" void testB1() { }");
+ buf.append("}\n");
+ basePkg.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ IPackageFragment teamPkg = sourceFolder.createPackageFragment(
+ "teamPkg",
+ false,
+ null);
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("import static java.lang.Math.max;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 playedBy B1 {\n");
+ buf.append(" void rm() { }\n");
+ buf.append(" rm <- after test\n");
+ buf.append(" base when (max(1,2)==2);\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu = teamPkg.createCompilationUnit("T1.java", buf
+ .toString(), false, null);
+
+ String[] order = new String[0];
+ IChooseImportQuery query = createQuery(
+ "T1",
+ new String[] {},
+ new int[] {});
+
+ OrganizeImportsOperation op = createOperation(cu, order,
+ 99, false, true, true, query);
+ op.run(null);
+
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("import static java.lang.Math.max;\n");
+ buf.append("import base basePkg.B1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R1 playedBy B1 {\n");
+ buf.append(" void rm() { }\n");
+ buf.append(" rm <- after test\n");
+ buf.append(" base when (max(1,2)==2);\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(cu.getSource(), buf.toString());
+ }
+
+ // Trac 19: organize imports must preserve a base import,
+ // even if role and base have the same name and the role
+ // is also referenced from a sibling role.
+ public void testRoleHidesBase1() throws CoreException, BackingStoreException {
+ IPackageFragmentRoot sourceFolder = JavaProjectHelper
+ .addSourceContainer(_project, "src");
+
+ IPackageFragment basePkg = sourceFolder.createPackageFragment(
+ "basePkg",
+ false,
+ null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package basePkg;\n");
+ buf.append("public class B1 {\n");
+ buf.append("}\n");
+ basePkg.createCompilationUnit("B1.java", buf.toString(), false, null);
+
+ IPackageFragment teamPkg = sourceFolder.createPackageFragment(
+ "teamPkg",
+ false,
+ null);
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("import base basePkg.B1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R2 {\n");
+ buf.append(" B1 other;\n");
+ buf.append(" }\n");
+ buf.append(" public class B1 playedBy B1 {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu = teamPkg.createCompilationUnit("T1.java", buf
+ .toString(), false, null);
+
+ String[] order = new String[0];
+ IChooseImportQuery query = createQuery(
+ "T1",
+ new String[] {},
+ new int[] {});
+
+ OrganizeImportsOperation op = createOperation(cu, order,
+ 99, false, true, true, query);
+ op.run(null);
+
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("import base basePkg.B1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R2 {\n");
+ buf.append(" B1 other;\n");
+ buf.append(" }\n");
+ buf.append(" public class B1 playedBy B1 {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(cu.getSource(), buf.toString());
+ }
+
+ public void testImportRole() throws CoreException, BackingStoreException {
+ IPackageFragmentRoot sourceFolder = JavaProjectHelper.addSourceContainer(_project, "src");
+
+ IPackageFragment basePkg = sourceFolder.createPackageFragment(
+ "basePkg",
+ false,
+ null);
+ StringBuffer buf = new StringBuffer();
+ buf.append("package basePkg;\n");
+ buf.append("public team class BaseTeam {\n");
+ buf.append(" public class BaseRole {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ basePkg.createCompilationUnit("BaseTeam.java", buf.toString(), false, null);
+
+ IPackageFragment teamPkg = sourceFolder.createPackageFragment(
+ "teamPkg",
+ false,
+ null);
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("import basePkg.BaseTeam;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" BaseTeam t;\n");
+ buf.append(" BaseRole r;\n");
+ buf.append("}\n");
+ ICompilationUnit cu = teamPkg.createCompilationUnit("T1.java", buf
+ .toString(), false, null);
+
+ String[] order = new String[0];
+ IChooseImportQuery query = createQuery(
+ "T1",
+ new String[] {},
+ new int[] {});
+
+ OrganizeImportsOperation op = createOperation(cu, order,
+ 99, false, true, true, query);
+ op.run(null);
+
+ buf = new StringBuffer();
+ buf.append("package teamPkg;\n");
+ buf.append("import basePkg.BaseTeam;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" BaseTeam t;\n");
+ buf.append(" BaseRole r;\n");
+ buf.append("}\n");
+ assertEqualString(cu.getSource(), buf.toString());
+ }
+
+ private OrganizeImportsOperation createOperation(ICompilationUnit cu, String[] order, int threshold, boolean ignoreLowerCaseNames, boolean save, boolean doResolve, IChooseImportQuery chooseImportQuery) throws CoreException, BackingStoreException {
+ setOrganizeImportSettings(order, threshold, threshold, cu.getJavaProject());
+ return new OrganizeImportsOperation(cu, null, ignoreLowerCaseNames, save, doResolve, chooseImportQuery);
+ }
+
+ private void setOrganizeImportSettings(String[] order, int threshold, int staticThreshold, IJavaProject project) throws BackingStoreException {
+ IEclipsePreferences scope= new ProjectScope(project.getProject()).getNode(JavaUI.ID_PLUGIN);
+ if (order == null) {
+ scope.remove(PreferenceConstants.ORGIMPORTS_IMPORTORDER);
+ scope.remove(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD);
+ } else {
+ StringBuffer buf= new StringBuffer();
+ for (int i= 0; i < order.length; i++) {
+ buf.append(order[i]);
+ buf.append(';');
+ }
+ scope.put(PreferenceConstants.ORGIMPORTS_IMPORTORDER, buf.toString());
+ scope.put(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD, String.valueOf(threshold));
+ }
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProjectTestSetup.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProjectTestSetup.java
new file mode 100644
index 000000000..f9cf3e086
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProjectTestSetup.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * 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
+ * $Id: ProjectTestSetup.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Fraunhofer FIRST - extended API and implementation
+ * Technical University Berlin - extended API and implementation
+ *******************************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.core;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.jdt.internal.ui.util.CoreUtility;
+import org.eclipse.jdt.testplugin.JavaProjectHelper;
+import org.eclipse.jdt.testplugin.TestOptions;
+import org.eclipse.objectteams.otdt.core.ext.OTDTPlugin;
+
+//{OT_COPY_PASTE: Copy of class org.eclipse.jdt.ui.tests.core.ProjectTestSetup
+/**
+ * Sets up an 1.5 project with rtstubs15.jar and compiler, code formatting, code generation, and template options.
+ */
+public class ProjectTestSetup extends TestSetup {
+
+ public static final String PROJECT_NAME= "TestSetupProject";
+
+ public static IJavaProject getProject() {
+ IProject project= ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
+ return JavaCore.create(project);
+ }
+
+ public static IClasspathEntry[] getDefaultClasspath() throws CoreException {
+ IPath[] rtJarPath= JavaProjectHelper.findRtJar(JavaProjectHelper.RT_STUBS_15);
+//{ObjectTeams: OTRE:
+ IPath otrePath = new Path("OTRE");
+/* orig:
+ return new IClasspathEntry[] { JavaCore.newLibraryEntry(rtJarPath[0], rtJarPath[1], rtJarPath[2], true) };
+ :giro */
+ return new IClasspathEntry[] { JavaCore.newLibraryEntry(rtJarPath[0], rtJarPath[1], rtJarPath[2], true), JavaCore.newContainerEntry(otrePath) };
+// SH}
+ }
+
+
+ private IJavaProject fJProject;
+
+ private boolean fAutobuilding;
+
+ public ProjectTestSetup(Test test) {
+ super(test);
+ }
+
+ /* (non-Javadoc)
+ * @see junit.extensions.TestSetup#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ IJavaProject project= getProject();
+ if (project.exists()) { // allow nesting of ProjectTestSetups
+ return;
+ }
+
+ fAutobuilding = CoreUtility.setAutoBuilding(false);
+//{ObjectTeams: create an OT project and keep otre.jar (don't overwrite with setRawClasspath)
+/* orig:
+ fJProject= JavaProjectHelper.createJavaProject(PROJECT_NAME, "bin");
+ fJProject.setRawClasspath(getDefaultClasspath(), null);
+ :giro */
+ fJProject = org.eclipse.objectteams.otdt.ui.tests.util.JavaProjectHelper.createOTJavaProject(PROJECT_NAME, "bin");
+ JavaProjectHelper.addRTJar(fJProject);
+//gbr}
+
+ TestOptions.initializeProjectOptions(fJProject);
+
+ JavaCore.setOptions(TestOptions.getDefaultOptions());
+ TestOptions.initializeCodeGenerationOptions();
+ JavaPlugin.getDefault().getCodeTemplateStore().load();
+ }
+
+ protected void tearDown() throws Exception {
+ if (fJProject != null) {
+ JavaProjectHelper.delete(fJProject);
+ CoreUtility.setAutoBuilding(fAutobuilding);
+ }
+ }
+
+}
+//gbr} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProposalAdaptor.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProposalAdaptor.java
new file mode 100644
index 000000000..8dc509d45
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/ProposalAdaptor.java
@@ -0,0 +1,42 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: ProposalAdaptor.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.core;
+
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+
+import base org.eclipse.jdt.internal.ui.text.java.ParameterGuessingProposal;
+
+public team class ProposalAdaptor {
+
+ /** Just decapsulate one private field ;-) */
+ protected class GuessingProposal playedBy ParameterGuessingProposal {
+
+ @SuppressWarnings("decapsulation")
+ protected
+ ICompletionProposal[][] getFChoices() -> get ICompletionProposal[][] fChoices;
+
+ }
+ /** API */
+ public ICompletionProposal[][] getChoices(ParameterGuessingProposal as GuessingProposal proposal) {
+ return proposal.getFChoices();
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/StringAsserts.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/StringAsserts.java
new file mode 100644
index 000000000..d4328540f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/StringAsserts.java
@@ -0,0 +1,200 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: StringAsserts.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.core;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import junit.framework.Assert;
+
+/**
+ * @author brcan
+ */
+public class StringAsserts
+{
+
+ public StringAsserts()
+ {
+ super();
+ }
+
+ private static int getDiffPos(String str1, String str2)
+ {
+ int len1 = Math.min(str1.length(), str2.length());
+
+ int diffPos = -1;
+ for (int i = 0; i < len1; i++)
+ {
+ if (str1.charAt(i) != str2.charAt(i))
+ {
+ diffPos = i;
+ break;
+ }
+ }
+ if (diffPos == -1 && str1.length() != str2.length())
+ {
+ diffPos = len1;
+ }
+ return diffPos;
+ }
+
+ private static final int printRange = 6;
+
+ public static void assertEqualString(String actual, String expected)
+ {
+ if (actual == null || expected == null)
+ {
+ if (actual == expected)
+ {
+ return;
+ }
+ if (actual == null)
+ {
+ Assert.assertTrue(
+ "Content not as expected: is 'null' expected: " + expected, false);
+ }
+ else
+ {
+ Assert.assertTrue(
+ "Content not as expected: expected 'null' is: " + actual, false);
+ }
+ }
+
+ int diffPos = getDiffPos(actual, expected);
+ if (diffPos != -1)
+ {
+ int diffAhead = Math.max(0, diffPos - printRange);
+ int diffAfter = Math.min(actual.length(), diffPos + printRange);
+
+ String diffStr = actual.substring(diffAhead, diffPos) + '^'
+ + actual.substring(diffPos, diffAfter);
+
+ // use detailed message
+ String message = "Content not as expected: is\n" + actual + "\nDiffers at pos " + diffPos + ": " + diffStr + "\nexpected:\n" + expected;
+
+ Assert.assertEquals(message, expected, actual);
+ }
+ }
+
+ public static void assertEqualStringIgnoreDelim(String actual, String expected)
+ throws IOException
+ {
+ if (actual == null || expected == null)
+ {
+ if (actual == expected)
+ {
+ return;
+ }
+ if (actual == null)
+ {
+ Assert.assertTrue(
+ "Content not as expected: is 'null' expected: " + expected, false);
+ }
+ else
+ {
+ Assert.assertTrue(
+ "Content not as expected: expected 'null' is: " + actual, false);
+ }
+ }
+
+ BufferedReader read1 = new BufferedReader(new StringReader(actual));
+ BufferedReader read2 = new BufferedReader(new StringReader(expected));
+
+ int line = 1;
+ do
+ {
+ String s1 = read1.readLine();
+ String s2 = read2.readLine();
+
+ if (s1 == null || !s1.equals(s2))
+ {
+ if (s1 == null && s2 == null)
+ {
+ return;
+ }
+ String diffStr = (s1 == null) ? s2 : s1;
+
+ String message = "Content not as expected: Content is: \n"
+ + actual + "\nDiffers at line " + line + ": " + diffStr
+ + "\nExpected contents: \n" + expected;
+ Assert.assertEquals(message, expected, actual);
+ }
+ line++;
+ }
+ while (true);
+ }
+
+ public static void assertEqualStringsIgnoreOrder(String[] actuals, String[] expecteds)
+ {
+ ArrayList<String> list1 = new ArrayList<String>(Arrays.asList(actuals));
+ ArrayList<String> list2 = new ArrayList<String>(Arrays.asList(expecteds));
+
+ for (int i = list1.size() - 1; i >= 0; i--)
+ {
+ if (list2.remove(list1.get(i)))
+ {
+ list1.remove(i);
+ }
+ }
+
+ int n1 = list1.size();
+ int n2 = list2.size();
+
+ if (n1 + n2 > 0)
+ {
+ if (n1 == 1 && n2 == 1)
+ {
+ assertEqualString((String) list1.get(0), (String) list2.get(0));
+ }
+
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < n1; i++)
+ {
+ String s1 = (String) list1.get(i);
+ if (s1 != null)
+ {
+ buf.append(s1);
+ buf.append("\n");
+ }
+ }
+ String actual = buf.toString();
+
+ buf = new StringBuffer();
+ for (int i = 0; i < n2; i++)
+ {
+ String s2 = (String) list2.get(i);
+ if (s2 != null)
+ {
+ buf.append(s2);
+ buf.append("\n");
+ }
+ }
+ String expected = buf.toString();
+
+ String message = "Content not as expected: Content is: \n" + actual
+ + "\nExpected contents: \n" + expected;
+ Assert.assertEquals(message, expected, actual);
+ }
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/UnresolvedMethodsQuickFixTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/UnresolvedMethodsQuickFixTest.java
new file mode 100644
index 000000000..c8acb537d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/core/UnresolvedMethodsQuickFixTest.java
@@ -0,0 +1,536 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: UnresolvedMethodsQuickFixTest.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.core;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.internal.corext.codemanipulation.StubUtility;
+import org.eclipse.jdt.internal.corext.template.java.CodeTemplateContextType;
+import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.jdt.internal.ui.text.correction.proposals.CUCorrectionProposal;
+import org.eclipse.jdt.ui.PreferenceConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+
+/**
+ * Testing corrections for unresolved methods in OT specific contexts.
+ * @author stephan
+ * @since 1.2.1
+ */
+public class UnresolvedMethodsQuickFixTest extends OTQuickFixTest {
+ private static final Class THIS= UnresolvedMethodsQuickFixTest.class;
+
+ public UnresolvedMethodsQuickFixTest(String name) {
+ super(name);
+ }
+
+ public static Test allTests() {
+ return setUpTest(new TestSuite(THIS));
+ }
+
+ public static Test suite() {
+ return allTests();
+ }
+
+ public static Test setUpTest(Test test) {
+ return new ProjectTestSetup(test);
+ }
+
+ @Override
+ protected void addOptions(Hashtable options) {
+ super.addOptions(options);
+ IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
+ store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, false);
+
+ StubUtility.setCodeTemplate(CodeTemplateContextType.METHODSTUB_ID, "", null);
+ StubUtility.setCodeTemplate(CodeTemplateContextType.CONSTRUCTORSTUB_ID, "", null);
+ }
+
+ public void testMethodInSameType() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.util.Vector;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R {\n");
+ buf.append(" void foo(Vector vec) {\n");
+ buf.append(" int i= goo(vec, true);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 2);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.util.Vector;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R {\n");
+ buf.append(" void foo(Vector vec) {\n");
+ buf.append(" int i= goo(vec, true);\n");
+ buf.append(" }\n");
+ buf.append("\n");
+ buf.append(" private int goo(Vector vec, boolean b) {\n");
+ buf.append(" return 0;\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+
+ proposal= (CUCorrectionProposal) proposals.get(1);
+ preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.util.Vector;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R {\n");
+ buf.append(" void foo(Vector vec) {\n");
+ buf.append(" int i= goo(vec, true);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("\n");
+ buf.append(" public int goo(Vector vec, boolean b) {\n");
+ buf.append(" return 0;\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testMethodInDifferentClass1() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.util.Vector;\n");
+ buf.append("public team class T {\n");
+ buf.append(" protected class R {\n");
+ buf.append(" void foo(Vector vec, R2 r) {\n");
+ buf.append(" int i= r.goo(vec, true);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("T.java", buf.toString(), false, null);
+
+ buf= new StringBuffer();
+ buf.append("team package test1.T;\n");
+ buf.append("public class R2 {\n");
+ buf.append("}\n");
+ IPackageFragment pack1T= fSourceFolder.createPackageFragment("test1.T", false, null);
+ pack1T.createCompilationUnit("R2.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 2); // 2nd proposal not really useful (cast to Object??)
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("team package test1.T;\n");
+ buf.append("\n");
+ buf.append("import java.util.Vector;\n");
+ buf.append("\n");
+ buf.append("public class R2 {\n");
+ buf.append("\n");
+ buf.append(" public int goo(Vector vec, boolean b) {\n");
+ buf.append(" return 0;\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ /* See Trac #12 */
+ public void testMethodInDifferentClass2() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("import java.util.Vector;\n");
+ buf.append("public team class T2 {\n");
+ buf.append(" public class R2 {\n");
+ buf.append(" void foo(final T1 t1, R<@t1> r, Vector vec) {\n");
+ buf.append(" int i= r.goo(vec, true);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("T2.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 2); // 2nd proposal not really useful (cast to Object??)
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("\n");
+ buf.append("import java.util.Vector;\n");
+ buf.append("\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R {\n");
+ buf.append("\n");
+ buf.append(" public int goo(Vector vec, boolean b) {\n");
+ buf.append(" return 0;\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testTSuperConstructor() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T2 extends T1 {\n");
+ buf.append(" protected class R {\n");
+ buf.append(" public R(int i) {\n");
+ buf.append(" tsuper(i);\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu1=pack1.createCompilationUnit("T2.java", buf.toString(), false, null);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class R {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu1);
+ ArrayList proposals= collectCorrections(cu1, astRoot);
+ assertNumberOfProposals(proposals, 2);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview1= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" protected class R {\n");
+ buf.append("\n");
+ buf.append(" public R(int i) {\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ String expected1= buf.toString();
+
+ proposal= (CUCorrectionProposal) proposals.get(1);
+ String preview2= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T2 extends T1 {\n");
+ buf.append(" protected class R {\n");
+ buf.append(" public R(int i) {\n");
+ buf.append(" tsuper();\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ String expected2= buf.toString();
+
+ assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
+
+ }
+
+ // static callin method created
+ public void testCallinMethod1() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class B {\n");
+ buf.append(" static void foo(int i) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("B.java", buf.toString(), false, null);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R playedBy B {\n");
+ buf.append(" void voo(int j) <- replace void foo(int i);\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 1); // don't propose to generate into team!!
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R playedBy B {\n");
+ buf.append(" void voo(int j) <- replace void foo(int i);\n");
+ buf.append(" static callin void voo(int j) {\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+ // non-static callin method created
+ public void testCallinMethod2() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class B {\n");
+ buf.append(" String foo(int i, Boolean b) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("B.java", buf.toString(), false, null);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R playedBy B {\n");
+ buf.append(" String voo(int j, Boolean b) <- replace String foo(int i, Boolean b);\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu= pack1.createCompilationUnit("T1.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu);
+ ArrayList proposals= collectCorrections(cu, astRoot);
+ assertNumberOfProposals(proposals, 1); // don't propose to generate into team!!
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public team class T1 {\n");
+ buf.append(" public class R playedBy B {\n");
+ buf.append(" String voo(int j, Boolean b) <- replace String foo(int i, Boolean b);\n");
+ buf.append(" callin String voo(int j, Boolean b) {\n");
+ buf.append(" return null;\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+/* some orig tests for use in OT-variants:
+
+ public void testClassInstanceCreation() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class E {\n");
+ buf.append(" public void foo(int i) {\n");
+ buf.append(" A a= new A(i);\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu1=pack1.createCompilationUnit("E.java", buf.toString(), false, null);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class A {\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("A.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu1);
+ ArrayList proposals= collectCorrections(cu1, astRoot);
+ assertNumberOfProposals(proposals, 2);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview1= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class A {\n");
+ buf.append("\n");
+ buf.append(" public A(int i) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ String expected1= buf.toString();
+
+ proposal= (CUCorrectionProposal) proposals.get(1);
+ String preview2= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class E {\n");
+ buf.append(" public void foo(int i) {\n");
+ buf.append(" A a= new A();\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ String expected2= buf.toString();
+
+ assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
+ }
+
+ public void testClassInstanceCreation2() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class E {\n");
+ buf.append(" public void foo(int i) {\n");
+ buf.append(" A a= new A(\"test\");\n");
+ buf.append(" }\n");
+ buf.append(" class A {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu1=pack1.createCompilationUnit("E.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu1);
+ ArrayList proposals= collectCorrections(cu1, astRoot);
+ assertNumberOfProposals(proposals, 2);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview1= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class E {\n");
+ buf.append(" public void foo(int i) {\n");
+ buf.append(" A a= new A(\"test\");\n");
+ buf.append(" }\n");
+ buf.append(" class A {\n");
+ buf.append("\n");
+ buf.append(" public A(String string) {\n");
+ buf.append(" }\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ String expected1= buf.toString();
+
+ proposal= (CUCorrectionProposal) proposals.get(1);
+ String preview2= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class E {\n");
+ buf.append(" public void foo(int i) {\n");
+ buf.append(" A a= new A();\n");
+ buf.append(" }\n");
+ buf.append(" class A {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ String expected2= buf.toString();
+
+ assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
+ }
+
+
+ public void testConstructorInvocation() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class E {\n");
+ buf.append(" public E(int i) {\n");
+ buf.append(" this(i, true);\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu1=pack1.createCompilationUnit("E.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu1);
+ ArrayList proposals= collectCorrections(cu1, astRoot);
+ assertNumberOfProposals(proposals, 1);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview1= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class E {\n");
+ buf.append(" public E(int i) {\n");
+ buf.append(" this(i, true);\n");
+ buf.append(" }\n");
+ buf.append("\n");
+ buf.append(" public E(int i, boolean b) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ String expected1= buf.toString();
+
+ assertEqualString(preview1, expected1);
+ }
+
+
+ public void testSuperMethodInvocation() throws Exception {
+ IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+ StringBuffer buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class E extends A {\n");
+ buf.append(" public void foo(int i) {\n");
+ buf.append(" super.foo(i);\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ ICompilationUnit cu1=pack1.createCompilationUnit("E.java", buf.toString(), false, null);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class A {\n");
+ buf.append("}\n");
+ pack1.createCompilationUnit("A.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= getASTRoot(cu1);
+ ArrayList proposals= collectCorrections(cu1, astRoot);
+ assertNumberOfProposals(proposals, 1);
+ assertCorrectLabels(proposals);
+
+ CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+ String preview= getPreviewContent(proposal);
+
+ buf= new StringBuffer();
+ buf.append("package test1;\n");
+ buf.append("public class A {\n");
+ buf.append("\n");
+ buf.append(" public void foo(int i) {\n");
+ buf.append(" }\n");
+ buf.append("}\n");
+ assertEqualString(preview, buf.toString());
+
+ }
+*/
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/AllTests.java
new file mode 100644
index 000000000..c617a8941
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/AllTests.java
@@ -0,0 +1,42 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: AllTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.hierarchy.contentprovider;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author ike
+ *
+ * $Id: AllTests.java 23495 2010-02-05 23:15:16Z stephan $
+ */
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.eclipse.objectteams.otdt.ui.tests.hierarchy.contentprovider");
+ //$JUnit-BEGIN$
+ suite.addTest(OTSubHierarchyContentProviderTests.suite());
+ suite.addTest(SuperHierarchyContentProviderTests.suite());
+ //$JUnit-END$
+ return suite;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/Comparator.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/Comparator.java
new file mode 100644
index 000000000..16c162028
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/Comparator.java
@@ -0,0 +1,27 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: Comparator.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.hierarchy.contentprovider;
+
+
+public interface Comparator
+{
+ public boolean same(Object o1, Object o2);
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/ITypeComparator.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/ITypeComparator.java
new file mode 100644
index 000000000..927c9992f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/ITypeComparator.java
@@ -0,0 +1,41 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: ITypeComparator.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.hierarchy.contentprovider;
+
+import org.eclipse.jdt.core.IType;
+
+
+public class ITypeComparator implements Comparator
+{
+ public boolean same(Object o1, Object o2)
+ {
+ if(o1 == null && o2 == null)
+ {
+ return true;
+ }
+ if((o1 == null || o2 == null)
+ || !(o1 instanceof IType && o2 instanceof IType))
+ {
+ return false;
+ }
+ return ((IType)o1).equals((IType)o2) ;
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java
new file mode 100644
index 000000000..6a76f9f61
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/OTSubHierarchyContentProviderTests.java
@@ -0,0 +1,366 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: OTSubHierarchyContentProviderTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.hierarchy.contentprovider;
+
+import junit.framework.Test;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.ui.typehierarchy.SubTypeHierarchyViewer;
+import org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyLifeCycle;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.objectteams.otdt.ui.tests.FileBasedUITest;
+
+/**
+ * @author haebor
+ *
+ * 18.07.2005
+ */
+public class OTSubHierarchyContentProviderTests extends FileBasedUITest
+{
+ private static final String FAKED_PLUGIN_ID = "org.eclipse.objectteams.otdt.tests";
+
+ private static final String PROJECT_DIR = "Hierarchy";
+ private static final String SRC_FOLDER = "src";
+
+ private SubTypeHierarchyViewer.SubTypeHierarchyContentProvider _testObject;
+ //call doHierarchyRefresh(IJavaElement element, null) on _lifeCycle
+ //to create a hierarchy on element.
+ private TypeHierarchyLifeCycle _lifeCycle;
+
+ private IType _T1;
+ private IType _T2;
+ private IType _T3;
+ private IType _T4;
+ private IType _T5;
+ private IType _T6;
+ private IType _T7;
+ private IType _T8;
+
+ private IType _T1_R1;
+ private IType _T1_R2;
+
+ private IType _T2_R1;
+ private IType _T2_R2;
+
+ private IType _T3_R1;
+ private IType _T3_R2;
+
+ private IType _T4_R2;
+
+ private IType _T5_R1;
+ private IType _T5_R2;
+ private IType _T5_R3;
+
+ private IType _T6_R1;
+
+ private IType _T7_R2;
+ private IType _T7_R3;
+
+ private IType _T8_R2;
+
+ private IType[] _allTypesInProject;
+
+
+ public OTSubHierarchyContentProviderTests(String name)
+ {
+ super(name);
+ }
+
+ protected String getPluginID()
+ {
+ //overwrites the ID because tests are using the
+ //workspace of org.eclipse.objectteams.otdt.tests
+ return FAKED_PLUGIN_ID;
+ }
+
+ public static Test suite()
+ {
+ if (true)
+ {
+ return new Suite(OTSubHierarchyContentProviderTests.class);
+ }
+ junit.framework.TestSuite suite = new Suite(OTSubHierarchyContentProviderTests.class
+ .getName());
+ return suite;
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir(PROJECT_DIR);
+
+ super.setUpSuite();
+
+
+ String pkg = "test001";
+
+ _T1 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T1");
+
+ _T2 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T2");
+
+ _T3 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T3");
+
+
+ _T4 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T4");
+
+ _T5 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T5");
+
+ _T6 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T6");
+
+
+ _T7 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T7");
+
+ _T8 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T8");
+
+ _T1_R1 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T1",
+ "R1").getCorrespondingJavaElement();
+
+ _T1_R2 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T1",
+ "R2").getCorrespondingJavaElement();
+
+ _T2_R1 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T2",
+ "R1").getCorrespondingJavaElement();
+
+ _T2_R2 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T2",
+ "R2").getCorrespondingJavaElement();
+
+ _T3_R1 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T3",
+ "R1").getCorrespondingJavaElement();
+
+ _T3_R2 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T3",
+ "R2").getCorrespondingJavaElement();
+
+ _T4_R2 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T4",
+ "R2").getCorrespondingJavaElement();
+
+ _T5_R1 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T5",
+ "R1").getCorrespondingJavaElement();
+
+ _T5_R2 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T5",
+ "R2").getCorrespondingJavaElement();
+
+ _T5_R3 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T5",
+ "R3").getCorrespondingJavaElement();
+
+ _T6_R1 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T6",
+ "R1").getCorrespondingJavaElement();
+
+ _T7_R2 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T7",
+ "R2").getCorrespondingJavaElement();
+
+ _T7_R3 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T7",
+ "R3").getCorrespondingJavaElement();
+
+ _T8_R2 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T8",
+ "R2").getCorrespondingJavaElement();
+
+
+ _allTypesInProject = new IType[]
+ {
+ _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8,
+ _T1_R1, _T1_R2,
+ _T2_R1, _T2_R2,
+ _T3_R1, _T3_R2,
+ _T4_R2,
+ _T5_R1, _T5_R2, _T5_R3,
+ _T6_R1,
+ _T7_R2, _T7_R3,
+ _T8_R2
+ };
+ _lifeCycle = new TypeHierarchyLifeCycle(false);
+ _testObject =
+ new SubTypeHierarchyViewer.SubTypeHierarchyContentProvider(
+ _lifeCycle);
+ }
+
+ public void testHierarchyCreated()
+ {
+ try
+ {
+ _lifeCycle.doHierarchyRefresh(_T1_R1, new NullProgressMonitor());
+ }
+ catch (JavaModelException exc)
+ {
+ exc.printStackTrace();
+ }
+
+ ITypeHierarchy hierarchy = _lifeCycle.getHierarchy();
+ assertNotNull(hierarchy);
+ }
+
+ public void testGetParentAlwaysNull()
+ {
+ Object expected = null;
+ Object actual;
+
+ for (int idx = 0; idx < _allTypesInProject.length; idx++)
+ {
+ IType cur = _allTypesInProject[idx];
+ actual = _testObject.getParent(cur);
+ assertEquals("Parent not null for " + cur.getElementName() + " ", expected, actual);
+ }
+ }
+
+ public void testRecursiveGetChildren_T1R1()
+ {
+ try
+ {
+ _lifeCycle.doHierarchyRefresh(_T1_R1, new NullProgressMonitor());
+ }
+ catch (JavaModelException exc)
+ {
+ exc.printStackTrace();
+ }
+
+ TreeNode actualRoot;
+ TreeNode expectedRoot;
+
+ //pretty ugly, maybe replace this with an automatic hierarchy creation
+ //that generates the hierarchy according to some String or with the help
+ //of an array of types that denotes a path :-I
+ expectedRoot = new TreeNode(_T1_R1);
+
+ expectedRoot.setChildrenByElements(new Object[] {_T2_R1});
+
+ expectedRoot.getChildNode(_T2_R1).setChildrenByElements(new Object[] {_T2_R2, _T3_R1, _T5_R1, _T6_R1, _T4_R2});
+
+ expectedRoot.getChildNode(_T2_R1).getChildNode(_T2_R2).setChildrenByElements(new Object[] {_T3_R2, _T4_R2, _T5_R2, _T8_R2});
+ expectedRoot.getChildNode(_T2_R1).getChildNode(_T3_R1).setChildrenByElements(new Object[] {_T3_R2});
+ expectedRoot.getChildNode(_T2_R1).getChildNode(_T5_R1).setChildrenByElements(new Object[] {_T5_R3, _T7_R3});
+ expectedRoot.getChildNode(_T2_R1).getChildNode(_T6_R1).setChildrenByElements(new Object[] {_T8_R2, _T2_R2});
+
+ expectedRoot.getChildNode(_T2_R1).getChildNode(_T2_R2).getChildNode(_T5_R2).setChildrenByElements(new Object[] {_T7_R2});
+ expectedRoot.getChildNode(_T2_R1).getChildNode(_T5_R1).getChildNode(_T5_R3).setChildrenByElements(new Object[] {_T7_R3, _T5_R2});
+ expectedRoot.getChildNode(_T2_R1).getChildNode(_T5_R1).getChildNode(_T7_R3).setChildrenByElements(new Object[] {_T7_R2});
+
+ expectedRoot.getChildNode(_T2_R1).getChildNode(_T5_R1).getChildNode(_T5_R3).getChildNode(_T7_R3).setChildrenByElements(new Object[] {_T7_R2});
+ expectedRoot.getChildNode(_T2_R1).getChildNode(_T5_R1).getChildNode(_T5_R3).getChildNode(_T5_R2).setChildrenByElements(new Object[] {_T7_R2});
+
+ expectedRoot.getChildNode(_T2_R1).getChildNode(_T6_R1).getChildNode(_T2_R2).setChildrenByElements(new Object[] {_T3_R2, _T5_R2, _T4_R2, _T8_R2});
+ expectedRoot.getChildNode(_T2_R1).getChildNode(_T6_R1).getChildNode(_T2_R2).getChildNode(_T5_R2).setChildrenByElements(new Object[]{_T7_R2});
+
+ actualRoot = fillTree(_testObject, new TreeNode(_T1_R1));
+
+ assertTrue("Hierarchy trees don't match", expectedRoot.equalsAsserted(actualRoot, new ITypeComparator(), 0));
+ }
+
+ private TreeNode fillTree(ITreeContentProvider contentProvider, TreeNode curNode)
+ {
+ Object[] children = contentProvider.getChildren(curNode.getElement());
+ TreeNode[] treeChildren = curNode.setChildrenByElements(children);
+
+ for (int idx = 0; idx < treeChildren.length; idx++)
+ {
+ fillTree(contentProvider, treeChildren[idx]);
+ }
+ return curNode;
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/SuperHierarchyContentProviderTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/SuperHierarchyContentProviderTests.java
new file mode 100644
index 000000000..7d7570bfb
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/SuperHierarchyContentProviderTests.java
@@ -0,0 +1,464 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: SuperHierarchyContentProviderTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.hierarchy.contentprovider;
+
+import junit.framework.Test;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.ui.typehierarchy.SuperTypeHierarchyViewer;
+import org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyLifeCycle;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.objectteams.otdt.ui.tests.FileBasedUITest;
+
+/**
+ * @author haebor
+ *
+ * 18.07.2005
+ */
+public class SuperHierarchyContentProviderTests extends FileBasedUITest
+{
+ private static final String FAKED_PLUGIN_ID = "org.eclipse.objectteams.otdt.tests";
+
+ private static final String PROJECT_DIR = "Hierarchy";
+ private static final String SRC_FOLDER = "src";
+
+ private SuperTypeHierarchyViewer.SuperTypeHierarchyContentProvider _testObject;
+ //call doHierarchyRefresh(IJavaElement element, null) on _lifeCycle
+ //to create a hierarchy on element.
+ private TypeHierarchyLifeCycle _lifeCycle;
+
+ private IType _objectType;
+
+ private IType _T1;
+ private IType _T2;
+ private IType _T3;
+ private IType _T4;
+ private IType _T5;
+ private IType _T6;
+ private IType _T7;
+ private IType _T8;
+
+ private IType _T1_R1;
+ private IType _T1_R2;
+
+ private IType _T2_R1;
+ private IType _T2_R2;
+
+ private IType _T3_R1;
+ private IType _T3_R2;
+
+ private IType _T4_R2;
+
+ private IType _T5_R1;
+ private IType _T5_R2;
+ private IType _T5_R3;
+
+ private IType _T6_R1;
+
+ private IType _T7_R2;
+ private IType _T7_R3;
+
+ private IType _T8_R2;
+
+ private IType[] _allTypesInProject;
+
+
+ public SuperHierarchyContentProviderTests(String name)
+ {
+ super(name);
+ }
+
+ protected String getPluginID()
+ {
+ //overwrites the ID because tests are using the
+ //workspace of org.eclipse.objectteams.otdt.tests
+ return FAKED_PLUGIN_ID;
+ }
+
+ public static Test suite()
+ {
+ if (true)
+ {
+ return new Suite(SuperHierarchyContentProviderTests.class);
+ }
+ junit.framework.TestSuite suite = new Suite(SuperHierarchyContentProviderTests.class
+ .getName());
+ return suite;
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir(PROJECT_DIR);
+
+ super.setUpSuite();
+
+
+ String pkg = "test001";
+
+ _T1 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T1");
+
+ _T2 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T2");
+
+ _T3 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T3");
+
+
+ _T4 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T4");
+
+ _T5 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T5");
+
+ _T6 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T6");
+
+
+ _T7 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T7");
+
+ _T8 =
+ getType(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T8");
+
+ _objectType =
+ getType(getTestProjectDir(),
+ "rt.jar",
+ "java.lang",
+ "Object");
+
+ _T1_R1 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T1",
+ "R1").getCorrespondingJavaElement();
+
+ _T1_R2 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T1",
+ "R2").getCorrespondingJavaElement();
+
+ _T2_R1 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T2",
+ "R1").getCorrespondingJavaElement();
+
+ _T2_R2 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T2",
+ "R2").getCorrespondingJavaElement();
+
+ _T3_R1 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T3",
+ "R1").getCorrespondingJavaElement();
+
+ _T3_R2 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T3",
+ "R2").getCorrespondingJavaElement();
+
+ _T4_R2 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T4",
+ "R2").getCorrespondingJavaElement();
+
+ _T5_R1 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T5",
+ "R1").getCorrespondingJavaElement();
+
+ _T5_R2 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T5",
+ "R2").getCorrespondingJavaElement();
+
+ _T5_R3 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T5",
+ "R3").getCorrespondingJavaElement();
+
+ _T6_R1 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T6",
+ "R1").getCorrespondingJavaElement();
+
+ _T7_R2 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T7",
+ "R2").getCorrespondingJavaElement();
+
+ _T7_R3 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T7",
+ "R3").getCorrespondingJavaElement();
+
+ _T8_R2 = (IType)
+ getRole(getTestProjectDir(),
+ SRC_FOLDER,
+ pkg,
+ "T8",
+ "R2").getCorrespondingJavaElement();
+
+
+ _allTypesInProject = new IType[]
+ {
+ _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8,
+ _T1_R1, _T1_R2,
+ _T2_R1, _T2_R2,
+ _T3_R1, _T3_R2,
+ _T4_R2,
+ _T5_R1, _T5_R2, _T5_R3,
+ _T6_R1,
+ _T7_R2, _T7_R3,
+ _T8_R2
+ };
+ _lifeCycle = new TypeHierarchyLifeCycle(true);
+ _testObject =
+ new SuperTypeHierarchyViewer.SuperTypeHierarchyContentProvider(
+ _lifeCycle);
+
+ try
+ {
+ _lifeCycle.doHierarchyRefresh(_T5_R3, new NullProgressMonitor());
+ }
+ catch (JavaModelException exc)
+ {
+ exc.printStackTrace();
+ fail("JavaModelException while refreshing hierarchy");
+ }
+ }
+
+ public void testHierarchyCreated()
+ {
+ ITypeHierarchy hierarchy = _lifeCycle.getHierarchy();
+ assertNotNull(hierarchy);
+ }
+
+ public void testGetParentAlwaysNull()
+ {
+ Object expected = null;
+ Object actual;
+
+ for (int idx = 0; idx < _allTypesInProject.length; idx++)
+ {
+ IType cur = _allTypesInProject[idx];
+ actual = _testObject.getParent(cur);
+ assertEquals("Parent not null for " + cur.getElementName() + " ", expected, actual);
+ }
+ }
+
+ public void testGetChildren_T5R3()
+ {
+ IType[] expected = new IType[]{ _T5_R1 };
+ IType[] actual = castToIType(_testObject.getChildren(_T5_R3));
+
+ assertTrue("Wrong supertypes", compareTypes(expected, actual));
+ }
+
+ public void testGetChildren_T3R2()
+ {
+ try
+ {
+ _lifeCycle.doHierarchyRefresh(_T3_R2, new NullProgressMonitor());
+ }
+ catch (JavaModelException exc)
+ {
+ exc.printStackTrace();
+ fail("JavaModelException while refreshing hierarchy");
+ }
+
+ IType[] expected = new IType[]{ _T3_R1, _T2_R2 };
+ IType[] actual = castToIType(_testObject.getChildren(_T3_R2));
+
+ assertTrue("Wrong supertypes", compareTypes(expected, actual));
+ }
+
+ public void testGetChildren_T1R2()
+ {
+ try
+ {
+ _lifeCycle.doHierarchyRefresh(_T1_R2, new NullProgressMonitor());
+ }
+ catch (JavaModelException exc)
+ {
+ exc.printStackTrace();
+ fail("JavaModelException while refreshing hierarchy");
+ }
+
+ IType[] expected = new IType[]{ _objectType };
+ IType[] actual = castToIType(_testObject.getChildren(_T1_R2));
+
+ assertTrue("Wrong supertypes", compareTypes(expected, actual));
+ }
+
+ public void testGetChildren_T8R2()
+ {
+ try
+ {
+ _lifeCycle.doHierarchyRefresh(_T8_R2, new NullProgressMonitor());
+ }
+ catch (JavaModelException exc)
+ {
+ exc.printStackTrace();
+ fail("JavaModelException while refreshing hierarchy");
+ }
+
+ IType[] expected = new IType[]{ _T6_R1, _T2_R2 };
+ IType[] actual = castToIType(_testObject.getChildren(_T8_R2));
+
+ assertTrue("Wrong supertypes", compareTypes(expected, actual));
+ }
+
+ public void testRecursiveGetChildren_T7R3()
+ {
+ try
+ {
+ _lifeCycle.doHierarchyRefresh(_T7_R3, new NullProgressMonitor());
+ }
+ catch (JavaModelException exc)
+ {
+ exc.printStackTrace();
+ fail("JavaModelException while refreshing hierarchy");
+ }
+
+ TreeNode actualRoot;
+ TreeNode expectedRoot;
+
+ //pretty ugly, maybe replace this with an automatic hierarchy creation
+ //that generates the hierarchy according to some String or with the help
+ //of an array of types that denotes a path :-I
+ expectedRoot = new TreeNode(_T7_R3);
+
+ expectedRoot.setChildrenByElements(new Object[] {_T5_R1, _T5_R3});
+ expectedRoot.getChildNode(_T5_R1).setChildrenByElements(new Object[] {_T2_R1, _objectType});
+ expectedRoot.getChildNode(_T5_R3).setChildrenByElements(new Object[] {_T5_R1});
+
+ expectedRoot.getChildNode(_T5_R1).getChildNode(_T2_R1).setChildrenByElements(new Object[] {_T1_R1, _objectType});
+ expectedRoot.getChildNode(_T5_R3).getChildNode(_T5_R1).setChildrenByElements(new Object[] {_T2_R1, _objectType});
+
+ expectedRoot.getChildNode(_T5_R3).getChildNode(_T5_R1).getChildNode(_T2_R1).setChildrenByElements(new Object[] {_T1_R1, _objectType});
+
+ expectedRoot.getChildNode(_T5_R1).getChildNode(_T2_R1).getChildNode(_T1_R1).setChildrenByElements(new Object[] {_objectType});
+
+ expectedRoot.getChildNode(_T5_R3).getChildNode(_T5_R1).getChildNode(_T2_R1).getChildNode(_T1_R1).setChildrenByElements(new Object[] {_objectType});
+
+
+ actualRoot = fillTree(_testObject, new TreeNode(_T7_R3));
+
+ assertTrue("Hierarchy trees don't match", expectedRoot.equalsAsserted(actualRoot, new ITypeComparator(), 0));
+ }
+
+// test looks quite incomplete!?
+// public void testOwnMethods_T8R2()
+// {
+// try
+// {
+// _lifeCycle.doHierarchyRefresh(_T8_R2, new NullProgressMonitor());
+// }
+// catch (JavaModelException exc)
+// {
+// exc.printStackTrace();
+// fail("JavaModelException while refreshing hierarchy");
+// }
+//
+// assertTrue("Wrong methods", false);
+// }
+
+ private TreeNode fillTree(ITreeContentProvider contentProvider, TreeNode curNode)
+ {
+ Object[] children = contentProvider.getChildren(curNode.getElement());
+ TreeNode[] treeChildren = curNode.setChildrenByElements(children);
+
+ for (int idx = 0; idx < treeChildren.length; idx++)
+ {
+ fillTree(contentProvider, treeChildren[idx]);
+ }
+ return curNode;
+ }
+
+ private IType[] castToIType(Object[] types)
+ {
+ if(types == null)
+ {
+ return null;
+ }
+ IType[] result = new IType[types.length];
+
+ for (int idx = 0; idx < types.length; idx++)
+ {
+ result[idx] = (IType)types[idx];
+ }
+ return result;
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java
new file mode 100644
index 000000000..e4a5edf06
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/hierarchy/contentprovider/TreeNode.java
@@ -0,0 +1,120 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: TreeNode.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.hierarchy.contentprovider;
+
+import java.util.HashMap;
+
+import org.eclipse.objectteams.otdt.tests.FileBasedTest;
+
+
+
+public class TreeNode
+{
+ private HashMap<Object, TreeNode> _children; //keys: elements, values: TreeNodes
+ private Object _element;
+
+ public TreeNode(Object element)
+ {
+ _element = element;
+ _children = new HashMap<Object, TreeNode>();
+ }
+
+ public TreeNode getChildNode(Object element)
+ {
+ return _children.get(element);
+ }
+
+ public TreeNode[] setChildrenByElements(Object[] childrenElements)
+ {
+ if(childrenElements == null)
+ {
+ return null;
+ }
+ for (int idx = 0; idx < childrenElements.length; idx++)
+ {
+ _children.put(childrenElements[idx], new TreeNode(childrenElements[idx]));
+ }
+ return getChildren();
+ }
+
+ public Object getElement()
+ {
+ return _element;
+ }
+
+ public TreeNode[] getChildren()
+ {
+ return _children.values().toArray(new TreeNode[_children.values().size()]);
+ }
+
+ public HashMap<Object, TreeNode> getChildrenMap()
+ {
+ return _children;
+ }
+
+ public Object[] getChildrenElements()
+ {
+ return _children.keySet().toArray();
+ }
+
+ public boolean equalsAsserted(TreeNode other, Comparator comp, int level)
+ {
+ if(!comp.same(_element, other.getElement()))
+ {
+ FileBasedTest.assertTrue("This tree element " + _element
+ + " is different from " + other.getElement()
+ + " at level: " + level, false);
+ return false;
+ }
+
+ HashMap<Object, TreeNode> othersChildren = other.getChildrenMap();
+ if(_children.size() != othersChildren.size())
+ {
+ FileBasedTest.assertEquals("this: " + _element + ", other: " + other.getElement() + " at level: "
+ + level, _children.size(), othersChildren.size());
+ return false;
+ }
+ if(_children.isEmpty())
+ {
+ return true;
+ }
+ Object[] childrenElements = _children.keySet().toArray();
+ for (int idx = 0; idx < childrenElements.length; idx++)
+ {
+ Object curChild = childrenElements[idx];
+ if(!othersChildren.containsKey(curChild))
+ {
+ FileBasedTest.assertTrue("Child " + curChild + " for parent " + other.getElement() + " at level " + level + " is missing", false);
+ return false;
+ }
+ }
+ level = level + 1;
+ for (int idx = 0; idx < childrenElements.length; idx++)
+ {
+ Object curChild = childrenElements[idx];
+ if(!_children.get(curChild).equalsAsserted(othersChildren.get(curChild), comp, level))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllInternalRoleCreationTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllInternalRoleCreationTests.java
new file mode 100644
index 000000000..3b3778592
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllInternalRoleCreationTests.java
@@ -0,0 +1,97 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: AllInternalRoleCreationTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.typecreator;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.eclipse.objectteams.otdt.tests.AbstractJavaModelTests;
+import org.eclipse.objectteams.otdt.tests.otmodel.TestDataHandler;
+import org.eclipse.objectteams.otdt.tests.otmodel.TestSetting;
+
+/**
+ * @author kaschja
+ * @version $Id: AllInternalRoleCreationTests.java 23495 2010-02-05 23:15:16Z stephan $
+ */
+public class AllInternalRoleCreationTests extends TestCase
+{
+ public AllInternalRoleCreationTests(String name)
+ {
+ super(name);
+ }
+
+ public static Class[] getAllTestClasses()
+ {
+ return new Class[]
+ {
+ org.eclipse.objectteams.otdt.ui.tests.typecreator.RoleCreationTests.class
+ };
+ }
+
+ public static TestSetting getActualTestSetting()
+ {
+ return new TestSetting("CreationTestProject", "internaldefinedrole", "teampkg");
+ }
+
+ public static Test suite()
+ {
+ TestSuite ts = new TestSuite(AllInternalRoleCreationTests.class.getName());
+
+ Class[] testClasses = getAllTestClasses();
+ // Reset forgotten subsets of tests
+// AbstractJavaModelTests.testsNames = null;
+// AbstractJavaModelTests.testsNumbers = null;
+// AbstractJavaModelTests.testsRange = null;
+
+ for (int idx = 0; idx < testClasses.length; idx++)
+ {
+ Class testClass = testClasses[idx];
+
+ // call the suite() method and add the resulting suite to the suite
+ try
+ {
+ TestDataHandler.addTestSetting(testClass, getActualTestSetting());
+
+ Method suiteMethod = testClass.getDeclaredMethod(
+ "suite", new Class[0]); //$NON-NLS-1$
+ Test suite = (Test) suiteMethod.invoke(null, new Object[0]);
+ ts.addTest(suite);
+ }
+ catch (IllegalAccessException ex)
+ {
+ ex.printStackTrace();
+ }
+ catch (InvocationTargetException ex)
+ {
+ ex.getTargetException().printStackTrace();
+ }
+ catch (NoSuchMethodException ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ return ts;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllTests.java
new file mode 100644
index 000000000..4b03858be
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/AllTests.java
@@ -0,0 +1,45 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: AllTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.typecreator;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author anklam
+ *
+ * @version $Id: AllTests.java 23495 2010-02-05 23:15:16Z stephan $
+ */
+public class AllTests
+{
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite(
+ "All TypeCreation Tests");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(NewTeamWizardPageListenerTest.class);
+ suite.addTest(RoleCreationTests.suite());
+ suite.addTest(TeamCreationTests.suite());
+ //$JUnit-END$
+ return suite;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/NewTeamWizardPageListenerTest.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/NewTeamWizardPageListenerTest.java
new file mode 100644
index 000000000..37e22cdb1
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/NewTeamWizardPageListenerTest.java
@@ -0,0 +1,56 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: NewTeamWizardPageListenerTest.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.typecreator;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField;
+import org.eclipse.objectteams.otdt.internal.ui.wizards.NewTeamWizardPage;
+import org.eclipse.objectteams.otdt.internal.ui.wizards.listeners.NewTeamWizardPageListener;
+
+/**
+ * @author anklam
+ *
+ * $Id: NewTeamWizardPageListenerTest.java 23495 2010-02-05 23:15:16Z stephan $
+ */
+public class NewTeamWizardPageListenerTest extends TestCase
+{
+ private NewTeamWizardPage _teamWizardPage;
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ _teamWizardPage = new NewTeamWizardPage();
+ NewTeamWizardPageListener listener = new NewTeamWizardPageListener(_teamWizardPage);
+ }
+
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+
+ public void testValidateTypeName()
+ {
+ StringDialogField teamName = _teamWizardPage.getTypeNameDialogField();
+ // validateTypeName() is called indirectly after setText()
+ teamName.setText("TEST");
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/RoleCreationTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/RoleCreationTests.java
new file mode 100644
index 000000000..460b3bd73
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/RoleCreationTests.java
@@ -0,0 +1,896 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: RoleCreationTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.typecreator;
+
+import java.util.ArrayList;
+
+import junit.framework.Test;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.objectteams.otdt.core.IOTType;
+import org.eclipse.objectteams.otdt.core.IRoleType;
+import org.eclipse.objectteams.otdt.core.OTModelManager;
+import org.eclipse.objectteams.otdt.internal.ui.wizards.typecreation.RoleCreator;
+import org.eclipse.objectteams.otdt.internal.ui.wizards.typecreation.RoleTypeInfo;
+import org.eclipse.objectteams.otdt.ui.tests.FileBasedUITest;
+
+/**
+ * @author kaschja
+ * @version $Id: RoleCreationTests.java 23495 2010-02-05 23:15:16Z stephan $
+ */
+public class RoleCreationTests extends FileBasedUITest
+{
+ /*this test class contains tests for internal defined roles*/
+ private static boolean DOINLINE = true;
+ private static String SRC_FOLDER_NAME = "internaldefinedrole";
+
+ private RoleCreator _roleCreator;
+
+
+ public RoleCreationTests(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ if (false)
+ {
+ Suite suite = new Suite(RoleCreationTests.class.getName());
+ suite.addTest(new RoleCreationTests("testRoleCreation_WithExplicitSuperClassAndInheritedMethod_FromSameTeam"));
+ return suite;
+ }
+ Suite suite = new Suite(RoleCreationTests.class);
+ return suite;
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir("CreationTestProject");
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ _roleCreator = new RoleCreator();
+ }
+
+// /**
+// * only for debug purposes
+// * if created directory is not deleted after a test run
+// * the next test run will fail because the types to be created already exist
+// */
+// public void tearDownSuite()
+// {
+// //don't call super method, so created directory will not be deleted
+// }
+
+ private IType getJavaType(String projectName, String srcFolderName, String pkgName, String typeName) throws JavaModelException
+ {
+ ICompilationUnit typeUnit = getCompilationUnit(
+ projectName,
+ srcFolderName,
+ pkgName,
+ typeName +".java");
+ IType typeJavaElem = typeUnit.getType(typeName);
+
+ if ((typeJavaElem != null) && (typeJavaElem.exists()))
+ {
+ return typeJavaElem;
+ }
+ return null;
+ }
+
+ /**
+ * This method tests the creation of a simple role class (no super role, no super interface, no base class)
+ * initially the role's hosting team class is empty
+ */
+ public void testRoleCreation_SimpleRole() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo("SimpleRole", pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg.TeamForSimpleRole");
+ typeInfo.setInline(false);
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForSimpleRole");
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg.TeamForSimpleRole", "SimpleRole");
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+ }
+
+ /**
+ * This method tests the creation of a simple role class (no super role, no super interface, no base class)
+ * initially the role's hosting team already contains one role class
+ */
+ public void testRoleCreation_SimpleRole_InTeamPreviouslyWithOneRole() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo("SimpleRole", pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg.TeamForSimpleRole_PreviouslyWithOneRole");
+ typeInfo.setInline(DOINLINE);
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForSimpleRole_PreviouslyWithOneRole");
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = enclosingTeamJavaElem.getType("SimpleRole");
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+ }
+
+ /**
+ * This method tests the creation of a simple role class (no super role, no super interface, no base class)
+ * initially the role's hosting team already contains several role classes
+ */
+ public void testRoleCreation_SimpleRole_InTeamPreviouslyWithSeveralRoles() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo("SimpleRole", pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg.TeamForSimpleRole_PreviouslyWithTwoRoles");
+ typeInfo.setInline(DOINLINE);
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForSimpleRole_PreviouslyWithTwoRoles");
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = enclosingTeamJavaElem.getType("SimpleRole");
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+ }
+
+ /**
+ * This method tests the creation of a role class that has one super interface
+ * initially the role's hosting team class is empty
+ */
+ public void testRoleCreation_WithOneSuperInterface() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ ArrayList<String> interfaceNameList = new ArrayList<String>();
+ interfaceNameList.add("ordinarypkg.InterfaceWithOneMethod");
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo("RoleWithOneSuperInterface", pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg.TeamForRoleWithOneSuperInterface");
+ typeInfo.setInline(DOINLINE);
+ typeInfo.setSuperInterfacesNames(interfaceNameList);
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithOneSuperInterface");
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithOneSuperInterface");
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+
+ String[] interfaceNames = roleOTElem.getSuperInterfaceNames();
+ assertNotNull(interfaceNames);
+ assertTrue(interfaceNames.length == 1);
+ assertEquals("InterfaceWithOneMethod", interfaceNames[0]);
+
+ String[] interfacesSignatures = roleOTElem.getSuperInterfaceTypeSignatures();
+ assertNotNull(interfacesSignatures);
+ assertTrue(interfacesSignatures.length == 1);
+ assertEquals("QInterfaceWithOneMethod;", interfacesSignatures[0]);
+ }
+
+ /**
+ * This method tests the creation of a role class that has several super interfaces
+ * initially the role's hosting team class is empty
+ */
+ public void testRoleCreation_WithSeveralSuperInterfaces() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ ArrayList<String> interfaceNameList = new ArrayList<String>();
+ interfaceNameList.add("ordinarypkg.InterfaceWithOneMethod");
+ interfaceNameList.add("ordinarypkg.InterfaceWithTwoMethods");
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo("RoleWithSeveralSuperInterfaces", pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg.TeamForRoleWithSeveralSuperInterfaces");
+ typeInfo.setInline(DOINLINE);
+ typeInfo.setSuperInterfacesNames(interfaceNameList);
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithSeveralSuperInterfaces");
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithSeveralSuperInterfaces");
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+
+ String[] interfaceNames = roleOTElem.getSuperInterfaceNames();
+ assertNotNull(interfaceNames);
+ assertTrue(interfaceNames.length > 0);
+ assertTrue(interfaceNames.length == 2);
+ assertEquals("InterfaceWithOneMethod", interfaceNames[0]);
+ assertEquals("InterfaceWithTwoMethods", interfaceNames[1]);
+
+ String[] interfacesSignatures = roleOTElem.getSuperInterfaceTypeSignatures();
+ assertNotNull(interfacesSignatures);
+ assertTrue(interfacesSignatures.length > 0);
+ assertTrue(interfacesSignatures.length == 2);
+ assertEquals("QInterfaceWithOneMethod;", interfacesSignatures[0]);
+ assertEquals("QInterfaceWithTwoMethods;", interfacesSignatures[1]);
+ }
+
+ /**
+ * This method tests the creation of a role class that has one super interface
+ * the role class should contain the abstract method that it inherits from its super interface
+ * initially the role's hosting team class is empty
+ */
+ public void testRoleCreation_WithOneSuperInterfaceAndInheritedMethod() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ ArrayList<String> interfaceNameList = new ArrayList<String>();
+ interfaceNameList.add("ordinarypkg.InterfaceWithOneMethod");
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo("RoleWithSuperInterfaceAndInheritedMethod", pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg.TeamForRoleWithOneSuperInterfaceAndInheritedMethod");
+ typeInfo.setInline(DOINLINE);
+ typeInfo.setSuperInterfacesNames(interfaceNameList);
+ typeInfo.setCreateAbstractInheritedMethods(true);
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithOneSuperInterfaceAndInheritedMethod");
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithSuperInterfaceAndInheritedMethod");
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+
+ String[] interfaceNames = roleOTElem.getSuperInterfaceNames();
+ assertNotNull(interfaceNames);
+ assertTrue(interfaceNames.length == 1);
+ assertEquals("InterfaceWithOneMethod", interfaceNames[0]);
+
+ String[] interfacesSignatures = roleOTElem.getSuperInterfaceTypeSignatures();
+ assertNotNull(interfacesSignatures);
+ assertTrue(interfacesSignatures.length == 1);
+ assertEquals("QInterfaceWithOneMethod;", interfacesSignatures[0]);
+
+ IMethod[] methods = roleJavaElem.getMethods();
+ assertNotNull(methods);
+ assertTrue(methods.length > 0);
+ assertTrue(methods.length == 1);
+ assertEquals("methodToImplement", methods[0].getElementName());
+ }
+
+ /**
+ * This method tests the creation of a role class that has several super interfaces
+ * the role class should contain all abstract methods that it inherits from its several super interfaces
+ * initially the role's hosting team class is empty
+ */
+ public void testRoleCreation_WithSeveralSuperInterfacesAndInheritedMethods() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ ArrayList<String> interfaceNameList = new ArrayList<String>();
+ interfaceNameList.add("ordinarypkg.InterfaceWithOneMethod");
+ interfaceNameList.add("ordinarypkg.InterfaceWithTwoMethods");
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo("RoleWithSeveralSuperInterfacesAndInheritedMethods", pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg.TeamForRoleWithSeveralSuperInterfacesAndInheritedMethods");
+ typeInfo.setInline(DOINLINE);
+ typeInfo.setSuperInterfacesNames(interfaceNameList);
+ typeInfo.setCreateAbstractInheritedMethods(true);
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithSeveralSuperInterfacesAndInheritedMethods");
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithSeveralSuperInterfacesAndInheritedMethods");
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+
+ String[] interfaceNames = roleOTElem.getSuperInterfaceNames();
+ assertNotNull(interfaceNames);
+ assertTrue(interfaceNames.length > 0);
+ assertTrue(interfaceNames.length == 2);
+ assertEquals("InterfaceWithOneMethod", interfaceNames[0]);
+ assertEquals("InterfaceWithTwoMethods", interfaceNames[1]);
+
+ String[] interfacesSignatures = roleOTElem.getSuperInterfaceTypeSignatures();
+ assertNotNull(interfacesSignatures);
+ assertTrue(interfacesSignatures.length > 0);
+ assertTrue(interfacesSignatures.length == 2);
+ assertEquals("QInterfaceWithOneMethod;", interfacesSignatures[0]);
+ assertEquals("QInterfaceWithTwoMethods;", interfacesSignatures[1]);
+
+ IMethod[] methods = roleJavaElem.getMethods();
+ assertNotNull(methods);
+ assertTrue(methods.length > 0);
+ assertTrue(methods.length == 3);
+
+ IMethod method = roleJavaElem.getMethod("methodToImplement", new String[0]);
+ assertNotNull(method);
+ assertTrue(method.exists());
+
+ method = roleJavaElem.getMethod("methodToImplementA", new String[0]);
+ assertNotNull(method);
+ assertTrue(method.exists());
+
+ method = roleJavaElem.getMethod("methodToImplementB", new String[0]);
+ assertNotNull(method);
+ assertTrue(method.exists());
+ }
+
+ /**
+ * This method tests the creation of a role class that is bound to a base class
+ * the base class is an ordinary class
+ * initially the role's hosting team class is empty
+ */
+ public void testRoleCreation_WithOrdinaryBase() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo("RoleWithOrdinaryBase", pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg.TeamForRoleWithOrdinaryBase");
+ typeInfo.setInline(DOINLINE);
+ typeInfo.setBaseTypeName("ordinarypkg.EmptyClass");
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithOrdinaryBase");
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithOrdinaryBase");
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+
+ assertTrue(roleOTElem instanceof IRoleType);
+ IRoleType roleOTRoleElem = (IRoleType) roleOTElem;
+ IType baseJavaElem = roleOTRoleElem.getBaseClass();
+
+ assertNotNull(baseJavaElem);
+ assertEquals("ordinarypkg.EmptyClass", baseJavaElem.getFullyQualifiedName());
+ }
+
+ /**
+ * This method tests the creation of a role class that is bound to a base class
+ * the base class is a team class
+ * initially the role's hosting team class is empty
+ */
+ public void testRoleCreation_WithTeamBase() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo("RoleWithTeamBase", pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg.TeamForRoleWithTeamBase");
+ typeInfo.setInline(DOINLINE);
+ typeInfo.setBaseTypeName("teampkg.EmptyBaseTeam");
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithTeamBase");
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithTeamBase");
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+
+ assertTrue(roleOTElem instanceof IRoleType);
+ IRoleType roleOTRoleElem = (IRoleType) roleOTElem;
+ IType baseJavaElem = roleOTRoleElem.getBaseClass();
+
+ assertNotNull(baseJavaElem);
+ assertEquals("teampkg.EmptyBaseTeam", baseJavaElem.getFullyQualifiedName());
+
+ IOTType baseOTElem = OTModelManager.getOTElement(baseJavaElem);
+ assertNotNull(baseOTElem);
+ assertTrue(baseOTElem.isTeam());
+ }
+
+
+ /**
+ * This method tests the creation of a role class that has an explicit superclass.
+ * The explicit superclass resides in the same team class as the newly created role class.
+ */
+ public void testRoleCreation_WithExplicitSuperClass_FromSameTeam() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ final String TEAM_CLASS_NAME = "TeamForRoleWithExplicitSuperclass_PreviouslyWithOneRole";
+ final String ROLE_CLASS_NAME = "RoleWithExplicitSuperClass";
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo(ROLE_CLASS_NAME, pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg."+TEAM_CLASS_NAME);
+ typeInfo.setInline(DOINLINE);
+ typeInfo.setSuperClassName("teampkg.TeamForRoleWithExplicitSuperclass_PreviouslyWithOneRole.SuperRole");
+ typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(ROLE_CLASS_NAME));
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", TEAM_CLASS_NAME);
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = enclosingTeamJavaElem.getType(ROLE_CLASS_NAME);
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+
+ assertEquals("SuperRole", roleJavaElem.getSuperclassName());
+ assertEquals("QSuperRole;", roleJavaElem.getSuperclassTypeSignature());
+ }
+
+
+ /**
+ * This method tests the creation of a role class that has an explicit superclass.
+ * The explicit superclass does not reside in the same team class as the newly created role class,
+ * but in a super team of that team.
+ */
+ public void testRoleCreation_WithExplicitSuperClass_FromSuperTeam() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ final String TEAM_CLASS_NAME = "TeamForRoleWithExplicitSuperclass_PreviouslyEmpty";
+ final String ROLE_CLASS_NAME = "RoleWithExplicitSuperClass";
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo(ROLE_CLASS_NAME, pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg."+TEAM_CLASS_NAME);
+ typeInfo.setInline(DOINLINE);
+//TODO (kaschja) ??? must "teampkg.TeamWithRoleWithAbstractMethod.RoleWithAbstractMethod" be set as super role class ??? (because it is the team class where the super role comes from)
+ typeInfo.setSuperClassName("teampkg.TeamForRoleWithExplicitSuperclass_PreviouslyEmpty.RoleWithAbstractMethod");
+ typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(ROLE_CLASS_NAME));
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", TEAM_CLASS_NAME);
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = enclosingTeamJavaElem.getType(ROLE_CLASS_NAME);
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+
+ assertEquals("RoleWithAbstractMethod", roleJavaElem.getSuperclassName());
+ assertEquals("QRoleWithAbstractMethod;", roleJavaElem.getSuperclassTypeSignature());
+ }
+
+
+ /**
+ * This method tests the creation of a role class that has an explicit superclass.
+ * the role class should contain the abstract method that it inherits from its superclass
+ * The explicit superclass resides in the same team class as the newly created role class.
+ */
+ public void testRoleCreation_WithExplicitSuperClassAndInheritedMethod_FromSameTeam() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ final String TEAM_CLASS_NAME = "TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyWithOneRole";
+ final String ROLE_CLASS_NAME = "RoleWithExplicitSuperClassAndInheritedMethod";
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo(ROLE_CLASS_NAME, pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg."+TEAM_CLASS_NAME);
+ typeInfo.setInline(DOINLINE);
+ typeInfo.setSuperClassName("teampkg.TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyWithOneRole.RoleWithAbstractMethod");
+ typeInfo.setCreateAbstractInheritedMethods(true);
+ typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(ROLE_CLASS_NAME));
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", TEAM_CLASS_NAME);
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = enclosingTeamJavaElem.getType(ROLE_CLASS_NAME);
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+
+ assertEquals("RoleWithAbstractMethod", roleJavaElem.getSuperclassName());
+ assertEquals("QRoleWithAbstractMethod;", roleJavaElem.getSuperclassTypeSignature());
+
+ IMethod[] methods = roleJavaElem.getMethods();
+ assertNotNull(methods);
+ assertTrue(methods.length > 0);
+ assertTrue(methods.length == 1);
+ assertEquals("methodToImplement1", methods[0].getElementName());
+ }
+
+
+ /**
+ * This method tests the creation of a role class that has an explicit superclass.
+ * The role class should contain the abstract method that it inherits from its superclass.
+ * The explicit superclass does not reside in the same team class as the newly created role class
+ * but in the super team of that team.
+ */
+ public void testRoleCreation_WithExplicitSuperClassAndInheritedMethod_FromSuperTeam() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ final String TEAM_CLASS_NAME = "TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyEmpty";
+ final String ROLE_CLASS_NAME = "RoleWithExplicitSuperClassAndInheritedMethod";
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo(ROLE_CLASS_NAME, pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg."+TEAM_CLASS_NAME);
+ typeInfo.setInline(DOINLINE);
+//TODO (kaschja) ??? must "teampkg.TeamWithRoleWithAbstractMethod.RoleWithAbstractMethod" be set as super role class ??? (because it is the team class where the super role comes from)
+// typeInfo.setSuperClassName("teampkg.TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyEmpty.RoleWithAbstractMethod");
+ typeInfo.setSuperClassName("teampkg.TeamWithRoleWithAbstractMethod.RoleWithAbstractMethod");
+ typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(ROLE_CLASS_NAME));
+
+
+ typeInfo.setCreateAbstractInheritedMethods(true);
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyEmpty");
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithExplicitSuperClassAndInheritedMethod");
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+
+ assertEquals("RoleWithAbstractMethod", roleJavaElem.getSuperclassName());
+ assertEquals("QRoleWithAbstractMethod;", roleJavaElem.getSuperclassTypeSignature());
+
+ IMethod[] methods = roleJavaElem.getMethods();
+ assertNotNull(methods);
+ assertTrue(methods.length > 0);
+ assertTrue(methods.length == 1);
+ assertEquals("methodToImplement1", methods[0].getElementName());
+ }
+
+
+ /**
+ * This method tests the creation of a role class that has an implicit superclass.
+ * The role class should contain the abstract method that it inherits from its superclass.
+ */
+ public void testRoleCreation_WithImplicitSuperClassAndInheritedMethod() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ final String TEAM_CLASS_NAME = "TeamForRoleWithImplicitSuperClassAndInheritedMethod";
+ final String ROLE_CLASS_NAME = "RoleWithAbstractMethod";
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo(ROLE_CLASS_NAME, pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg."+TEAM_CLASS_NAME);
+ typeInfo.setInline(DOINLINE);
+ typeInfo.setCreateAbstractInheritedMethods(true);
+ typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(ROLE_CLASS_NAME));
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithImplicitSuperClassAndInheritedMethod");
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithAbstractMethod");
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+
+ IMethod[] methods = roleJavaElem.getMethods();
+ assertNotNull(methods);
+ assertTrue(methods.length > 0);
+ assertTrue(methods.length == 1);
+ assertEquals("methodToImplement1", methods[0].getElementName());
+ }
+
+
+ /**
+ * This method tests the creation of a role class that has
+ * an implicit superclass and an explicit superclass and several super interfaces.
+ * The role class should contain all abstract methods that it inherits from
+ * its several super classes and interfaces
+ */
+ public void testRoleCreation_WithSeveralSuperTypesAndInheritedMethods() throws InterruptedException,
+ CoreException
+ {
+ /*creation of role*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ ArrayList<String> interfaceNameList = new ArrayList<String>();
+ interfaceNameList.add("ordinarypkg.InterfaceWithOneMethod");
+ interfaceNameList.add("ordinarypkg.InterfaceWithTwoMethods");
+
+ //the role to be created should be named "RoleWithAbstractMethod" although it contains several abstract methods
+ //in order to establish the implicit inheritence relationship with TeamWithRoleWithAbstractMethod.RoleWithAbstractMethod
+ final String ROLE_CLASS_NAME = "RoleWithAbstractMethod";
+ final String TEAM_CLASS_NAME = "TeamForRoleWithSeveralSuperTypesAndInheritedMethods";
+
+ RoleTypeInfo typeInfo = new RoleTypeInfo(ROLE_CLASS_NAME, pkgFragRoot, pkgFrag);
+ typeInfo.setEnclosingTypeName("teampkg."+TEAM_CLASS_NAME);
+ typeInfo.setInline(DOINLINE);
+ typeInfo.setSuperClassName("teampkg.TeamForRoleWithSeveralSuperTypesAndInheritedMethods.AbstractSuperRole");
+ typeInfo.setSuperInterfacesNames(interfaceNameList);
+ typeInfo.setCreateAbstractInheritedMethods(true);
+ typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(ROLE_CLASS_NAME));
+
+ assertNotNull(_roleCreator);
+ _roleCreator.setTypeInfo(typeInfo);
+ _roleCreator.createType(new NullProgressMonitor());
+
+ /*test of role existence and properties*/
+
+ IType enclosingTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForRoleWithSeveralSuperTypesAndInheritedMethods");
+ assertNotNull(enclosingTeamJavaElem);
+
+ IType roleJavaElem = enclosingTeamJavaElem.getType("RoleWithAbstractMethod");
+ assertNotNull(roleJavaElem);
+ assertTrue(roleJavaElem.exists());
+
+ IOTType roleOTElem = OTModelManager.getOTElement(roleJavaElem);
+ assertNotNull(roleOTElem);
+ assertTrue(roleOTElem.isRole());
+
+ assertEquals("AbstractSuperRole", roleJavaElem.getSuperclassName());
+ assertEquals("QAbstractSuperRole;", roleJavaElem.getSuperclassTypeSignature());
+
+ String[] interfaceNames = roleJavaElem.getSuperInterfaceNames();
+ assertNotNull(interfaceNames);
+ assertTrue(interfaceNames.length > 0);
+ assertTrue(interfaceNames.length == 2);
+ assertEquals("InterfaceWithOneMethod", interfaceNames[0]);
+ assertEquals("InterfaceWithTwoMethods", interfaceNames[1]);
+
+ String[] interfaceSignatures = roleJavaElem.getSuperInterfaceTypeSignatures();
+ assertNotNull(interfaceSignatures);
+ assertTrue(interfaceSignatures.length > 0);
+ assertTrue(interfaceSignatures.length == 2);
+ assertEquals("QInterfaceWithOneMethod;", interfaceSignatures[0]);
+ assertEquals("QInterfaceWithTwoMethods;", interfaceSignatures[1]);
+
+ IMethod[] methods = roleJavaElem.getMethods();
+ assertNotNull(methods);
+ assertTrue(methods.length > 0);
+ assertTrue(methods.length == 5);
+
+ //method inherited from "InterfaceWithOneMethod"
+ IMethod method = roleJavaElem.getMethod("methodToImplement", new String[0]);
+ assertNotNull(method);
+ assertTrue(method.exists());
+
+ //methods inherited from "InterfaceWithTwoMethods"
+ method = roleJavaElem.getMethod("methodToImplementA", new String[0]);
+ assertNotNull(method);
+ assertTrue(method.exists());
+ method = roleJavaElem.getMethod("methodToImplementB", new String[0]);
+ assertNotNull(method);
+ assertTrue(method.exists());
+
+ //method inherited from explicit superclass "AbstractSuperRole"
+ method = roleJavaElem.getMethod("methodToImplementX", new String[0]);
+ assertNotNull(method);
+ assertTrue(method.exists());
+
+ //method inherited from implicit superclass "TeamWithRoleWithAbstractMethod.RoleWithAbstractMethod"
+ method = roleJavaElem.getMethod("methodToImplement1", new String[0]);
+ assertNotNull(method);
+ assertTrue(method.exists());
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/TeamCreationTests.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/TeamCreationTests.java
new file mode 100644
index 000000000..0589bd9eb
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/typecreator/TeamCreationTests.java
@@ -0,0 +1,401 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: TeamCreationTests.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.typecreator;
+
+import java.util.ArrayList;
+
+import junit.framework.Test;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IInitializer;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.objectteams.otdt.core.IOTType;
+import org.eclipse.objectteams.otdt.core.OTModelManager;
+import org.eclipse.objectteams.otdt.internal.ui.wizards.typecreation.TeamCreator;
+import org.eclipse.objectteams.otdt.internal.ui.wizards.typecreation.TypeInfo;
+import org.eclipse.objectteams.otdt.ui.tests.FileBasedUITest;
+
+/**
+ * @author kaschja
+ * @version $Id: TeamCreationTests.java 23495 2010-02-05 23:15:16Z stephan $
+ */
+public class TeamCreationTests extends FileBasedUITest
+{
+
+ private static final String SRC_FOLDER_NAME = "teams";
+
+ private TeamCreator _teamCreator;
+
+
+ public TeamCreationTests(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ if (false)
+ {
+ Suite suite = new Suite(TeamCreationTests.class.getName());
+ suite.addTest(new TeamCreationTests("testCreation_TeamWithSuperInterfaceAndInheritedMethod"));
+ return suite;
+ }
+ junit.framework.TestSuite suite = new Suite(TeamCreationTests.class);
+ return suite;
+ }
+
+ public void setUpSuite() throws Exception
+ {
+ setTestProjectDir("CreationTestProject");
+
+ super.setUpSuite();
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ _teamCreator = new TeamCreator();
+ }
+
+// /**
+// * only for debug purposes
+// * suppresses the deletion of the folders and files that have been created during the test run
+// */
+// public void tearDownSuite()
+// {
+// //don't call super method, so created directory will not be deleted
+// }
+
+
+ private IType getJavaType(String projectName, String srcFolderName, String pkgName, String typeName) throws JavaModelException
+ {
+ ICompilationUnit typeUnit = getCompilationUnit(
+ projectName,
+ srcFolderName,
+ pkgName,
+ typeName +".java");
+ IType typeJavaElem = typeUnit.getType(typeName);
+
+ if ((typeJavaElem != null) && (typeJavaElem.exists()))
+ {
+ return typeJavaElem;
+ }
+ return null;
+ }
+
+
+ public void testCreation_EmptyTeam() throws JavaModelException,
+ InterruptedException,
+ CoreException
+ {
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ TypeInfo typeInfo = new TypeInfo("EmptyTeam", pkgFragRoot, pkgFrag);
+ typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
+ typeInfo.setSuperClassName("org.objectteams.Team");
+
+ assertNotNull(_teamCreator);
+ _teamCreator.setTypeInfo(typeInfo);
+ _teamCreator.createType(new NullProgressMonitor());
+
+ IType createdJavaType = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "EmptyTeam");
+ assertNotNull(createdJavaType);
+
+ IOTType createdOTType = OTModelManager.getOTElement(createdJavaType);
+ assertNotNull(createdOTType);
+ assertTrue(createdOTType.isTeam());
+ }
+
+
+ public void testCreation_NestedTeam() throws JavaModelException,
+ InterruptedException,
+ CoreException
+ {
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ TypeInfo typeInfo = new TypeInfo("NestedTeam", pkgFragRoot, pkgFrag);
+ typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
+ typeInfo.setEnclosingTypeName("teampkg.TeamForNestedTeam");
+ typeInfo.setInline(true);
+ typeInfo.setCreateAbstractInheritedMethods(true);
+
+ assertNotNull(_teamCreator);
+ _teamCreator.setTypeInfo(typeInfo);
+ _teamCreator.createType(new NullProgressMonitor());
+
+ IType enclosingJavaType = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamForNestedTeam");
+ IType createdJavaType = enclosingJavaType.getType("NestedTeam");
+ assertNotNull(createdJavaType);
+ assertTrue("created type should exist", createdJavaType.exists());
+
+ IOTType createdOTType = OTModelManager.getOTElement(createdJavaType);
+ assertNotNull(createdOTType);
+ assertTrue(createdOTType.isTeam());
+
+ IMethod[] methods = createdJavaType.getMethods();
+ assertEquals("Should not have created methods", 0, methods.length);
+ }
+
+
+ public void testCreation_TeamWithConstructor() throws JavaModelException,
+ InterruptedException,
+ CoreException
+ {
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ String TEAM_CLASS_NAME = "TeamWithConstructor";
+ TypeInfo typeInfo = new TypeInfo(TEAM_CLASS_NAME, pkgFragRoot, pkgFrag);
+ typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
+ typeInfo.setSuperClassName("org.objectteams.Team");
+ typeInfo.setCreateConstructor(true);
+ typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(TEAM_CLASS_NAME));
+
+ assertNotNull(_teamCreator);
+ _teamCreator.setTypeInfo(typeInfo);
+ _teamCreator.createType(new NullProgressMonitor());
+
+ IType createdJavaType = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", TEAM_CLASS_NAME);
+ assertNotNull(createdJavaType);
+
+ IOTType createdOTType = OTModelManager.getOTElement(createdJavaType);
+ assertNotNull(createdOTType);
+ assertTrue(createdOTType.isTeam());
+
+ // constructor is a method by the name of the enclosing class:
+ IMethod constructor = createdJavaType.getMethod(TEAM_CLASS_NAME, new String[0]);
+ assertNotNull(constructor);
+ assertTrue(constructor.exists());
+ }
+
+ public void testCreation_TeamWithMainMethod() throws JavaModelException,
+ InterruptedException,
+ CoreException
+ {
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ TypeInfo typeInfo = new TypeInfo("TeamWithMainMethod", pkgFragRoot, pkgFrag);
+ typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
+ typeInfo.setSuperClassName("org.objectteams.Team");
+ typeInfo.setCreateMainMethod(true);
+
+ assertNotNull(_teamCreator);
+ _teamCreator.setTypeInfo(typeInfo);
+ _teamCreator.createType(new NullProgressMonitor());
+
+ IType createdJavaType = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamWithMainMethod");
+ assertNotNull(createdJavaType);
+
+ IOTType createdOTType = OTModelManager.getOTElement(createdJavaType);
+ assertNotNull(createdOTType);
+ assertTrue(createdOTType.isTeam());
+
+ String[] paraTypes = {"[QString;"};
+ IMethod method = createdJavaType.getMethod("main", paraTypes);
+ assertNotNull(method);
+ assertTrue(method.exists());
+}
+
+ public void testCreation_EmptyTeamWithEmptySuperTeam() throws JavaModelException,
+ InterruptedException,
+ CoreException
+ {
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ String TEAM_CLASS_NAME = "EmptyTeamWithEmptySuperTeam";
+ TypeInfo typeInfo = new TypeInfo(TEAM_CLASS_NAME, pkgFragRoot, pkgFrag);
+ typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
+ typeInfo.setSuperClassName("teampkg.EmptyTeam");
+ typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(TEAM_CLASS_NAME));
+
+ assertNotNull(_teamCreator);
+ _teamCreator.setTypeInfo(typeInfo);
+ _teamCreator.createType(new NullProgressMonitor());
+
+ IType subTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "EmptyTeamWithEmptySuperTeam");
+ assertNotNull(subTeamJavaElem);
+
+ IOTType subTeamOTElem = OTModelManager.getOTElement(subTeamJavaElem);
+ assertNotNull(subTeamOTElem);
+ assertTrue(subTeamOTElem.isTeam());
+
+ assertEquals(subTeamOTElem.getSuperclassName(), "EmptyTeam");
+ assertEquals(subTeamOTElem.getSuperclassTypeSignature(), "QEmptyTeam;");
+ }
+
+
+ public void testCreation_EmptyTeamWithSuperInterface() throws JavaModelException,
+ InterruptedException,
+ CoreException
+ {
+ IType interfaceJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "ordinarypkg", "InterfaceWithOneMethod");
+ assertNotNull(interfaceJavaElem);
+ assertTrue(interfaceJavaElem.exists());
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ ArrayList<String> interfaceNames = new ArrayList<String>();
+ interfaceNames.add("ordinary.InterfaceWithOneMethod");
+
+ TypeInfo typeInfo = new TypeInfo("EmptyTeamWithSuperInterface", pkgFragRoot, pkgFrag);
+ typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
+ typeInfo.setSuperInterfacesNames(interfaceNames);
+
+ assertNotNull(_teamCreator);
+ _teamCreator.setTypeInfo(typeInfo);
+ _teamCreator.createType(new NullProgressMonitor());
+
+ IType createdJavaType = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "EmptyTeamWithSuperInterface");
+ assertNotNull(createdJavaType);
+
+ IOTType createdOTType = OTModelManager.getOTElement(createdJavaType);
+ assertNotNull(createdOTType);
+ assertTrue(createdOTType.isTeam());
+
+ String[] interfaces = createdOTType.getSuperInterfaceNames();
+ assertNotNull(interfaces);
+ assertTrue(interfaces.length == 1);
+ assertEquals(interfaces[0], "InterfaceWithOneMethod");
+
+ String[] interfaceSignatures = createdOTType.getSuperInterfaceTypeSignatures();
+ assertNotNull(interfaceSignatures);
+ assertTrue(interfaceSignatures.length == 1);
+ assertEquals(interfaceSignatures[0], "QInterfaceWithOneMethod;");
+ }
+
+
+ public void testCreation_TeamWithSuperInterfaceAndInheritedMethod() throws JavaModelException,
+ InterruptedException,
+ CoreException
+ {
+ IType interfaceJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "ordinarypkg", "InterfaceWithOneMethod");
+ assertNotNull(interfaceJavaElem);
+ assertTrue(interfaceJavaElem.exists());
+
+ /*creation of team*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ ArrayList<String> interfaceNames = new ArrayList<String>();
+ interfaceNames.add("ordinarypkg.InterfaceWithOneMethod");
+
+ String TEAM_CLASS_NAME = "TeamWithSuperInterfaceAndInheritedMethod";
+ TypeInfo typeInfo = new TypeInfo(TEAM_CLASS_NAME, pkgFragRoot, pkgFrag);
+ typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
+ typeInfo.setSuperInterfacesNames(interfaceNames);
+ typeInfo.setCreateAbstractInheritedMethods(true);
+ typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(TEAM_CLASS_NAME));
+
+ assertNotNull(_teamCreator);
+ _teamCreator.setTypeInfo(typeInfo);
+ _teamCreator.createType(new NullProgressMonitor());
+
+ IType createdJavaType = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamWithSuperInterfaceAndInheritedMethod");
+ assertNotNull(createdJavaType);
+
+ IOTType createdOTType = OTModelManager.getOTElement(createdJavaType);
+ assertNotNull(createdOTType);
+ assertTrue(createdOTType.isTeam());
+
+ String[] interfaces = createdOTType.getSuperInterfaceNames();
+ assertNotNull(interfaces);
+ assertTrue(interfaces.length == 1);
+ assertEquals(interfaces[0], "InterfaceWithOneMethod");
+
+ String[] interfaceSignatures = createdOTType.getSuperInterfaceTypeSignatures();
+ assertNotNull(interfaceSignatures);
+ assertTrue(interfaceSignatures.length == 1);
+ assertEquals(interfaceSignatures[0], "QInterfaceWithOneMethod;");
+
+ IMethod method = createdJavaType.getMethod("methodToImplement", new String[0]);
+ assertNotNull(method);
+ assertTrue(method.exists());
+ }
+
+
+ public void testCreation_TeamWithSuperTeamAndInheritedMethod() throws JavaModelException,
+ InterruptedException,
+ CoreException
+ {
+ IType superTeamJavaElem = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "AbstractTeamWithAbstractMethod");
+ assertNotNull(superTeamJavaElem);
+ assertTrue(superTeamJavaElem.exists());
+
+ /*creation of team*/
+
+ IPackageFragmentRoot pkgFragRoot = getPackageFragmentRoot(getTestProjectDir(), SRC_FOLDER_NAME);
+ IPackageFragment pkgFrag = getPackageFragment(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg");
+ assertNotNull(pkgFragRoot);
+ assertNotNull(pkgFrag);
+
+ String TEAM_CLASS_NAME = "TeamWithSuperTeamAndInheritedMethod";
+ TypeInfo typeInfo = new TypeInfo(TEAM_CLASS_NAME, pkgFragRoot, pkgFrag);
+ typeInfo.setModifier(Flags.AccPublic+Flags.AccTeam);
+ typeInfo.setSuperClassName("teampkg.AbstractTeamWithAbstractMethod");
+ typeInfo.setCreateAbstractInheritedMethods(true);
+ typeInfo.setCurrentType(pkgFrag.getCompilationUnit(TEAM_CLASS_NAME+".java").getType(TEAM_CLASS_NAME));
+
+ assertNotNull(_teamCreator);
+ _teamCreator.setTypeInfo(typeInfo);
+ _teamCreator.createType(new NullProgressMonitor());
+
+ IType createdJavaType = getJavaType(getTestProjectDir(), SRC_FOLDER_NAME, "teampkg", "TeamWithSuperTeamAndInheritedMethod");
+ assertNotNull(createdJavaType);
+
+ IOTType createdOTType = OTModelManager.getOTElement(createdJavaType);
+ assertNotNull(createdOTType);
+ assertTrue(createdOTType.isTeam());
+
+ assertEquals(createdJavaType.getSuperclassName(), "AbstractTeamWithAbstractMethod");
+ assertEquals(createdJavaType.getSuperclassTypeSignature(), "QAbstractTeamWithAbstractMethod;");
+
+ IMethod method = createdJavaType.getMethod("methodToImplement", new String[0]);
+ assertNotNull(method);
+ assertTrue(method.exists());
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/JavaProjectHelper.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/JavaProjectHelper.java
new file mode 100644
index 000000000..8acb13421
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/JavaProjectHelper.java
@@ -0,0 +1,144 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: JavaProjectHelper.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.util;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.ui.util.CoreUtility;
+import org.eclipse.objectteams.otdt.core.ext.OTDTPlugin;
+import org.eclipse.objectteams.otdt.core.ext.OTREContainer;
+import org.eclipse.objectteams.otdt.ui.tests.TestPlugin;
+
+/**
+ * Helper methods to set up a IJavaProject.
+ */
+public class JavaProjectHelper extends org.eclipse.jdt.testplugin.JavaProjectHelper
+{
+
+ public static final IPath RT_STUBS = new Path("testresources/rtstubs.jar");
+
+ /**
+ * OT: new method: OT specific project creation.
+ * Creates a IJavaProject.
+ */
+ public static IJavaProject createOTJavaProject(String projectName,
+ String binFolderName) throws CoreException
+ {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IProject project = root.getProject(projectName);
+ if (!project.exists())
+ {
+ project.create(null);
+ }
+ else
+ {
+ project.refreshLocal(IResource.DEPTH_INFINITE, null);
+ }
+
+ if (!project.isOpen())
+ {
+ project.open(null);
+ }
+
+ IPath outputLocation;
+ if (binFolderName != null && binFolderName.length() > 0)
+ {
+ IFolder binFolder = project.getFolder(binFolderName);
+ if (!binFolder.exists())
+ {
+ CoreUtility.createFolder(binFolder, false, true, null);
+ }
+ outputLocation = binFolder.getFullPath();
+ }
+ else
+ {
+ outputLocation = project.getFullPath();
+ }
+
+ if (!project.hasNature(JavaCore.NATURE_ID) &&
+ !project.hasNature(JavaCore.OTJ_NATURE_ID))
+ {
+ addNatureToProject(project, JavaCore.NATURE_ID, null);
+ //add OT nature to project
+ addNatureToProject(project, JavaCore.OTJ_NATURE_ID, null);
+ }
+ IProjectDescription description = project.getDescription();
+ //add OT build spec to project
+ description.setBuildSpec(OTDTPlugin.createProjectBuildCommands(description));
+ project.setDescription(description, null);
+
+ IJavaProject jproject = JavaCore.create(project);
+
+ jproject.setOutputLocation(outputLocation, null);
+ jproject.setRawClasspath(new IClasspathEntry[0], null);
+
+ OTREContainer.initializeOTJProject(project);
+
+ return jproject;
+ }
+
+ /**
+ * OT: use our TestPlugin:
+ * Try to find rt.jar
+ */
+ public static IPath[] findRtJar()
+ {
+ File rtStubs = TestPlugin.getDefault().getFileInPlugin(
+ RT_STUBS);
+ if (rtStubs != null && rtStubs.exists())
+ {
+ return new IPath[] { new Path(rtStubs.getPath()), null, null };
+ }
+
+ return null;
+ }
+
+ /**
+ * Additional Method:
+ * Sets autobuilding state for the test workspace.
+ */
+ public static boolean setAutoBuilding(boolean state) throws CoreException
+ {
+ // disable auto build
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription desc = workspace.getDescription();
+ boolean result = desc.isAutoBuilding();
+ desc.setAutoBuilding(state);
+ workspace.setDescription(desc);
+ return result;
+ }
+
+}
+
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/TestOptions.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/TestOptions.java
new file mode 100644
index 000000000..6c2003f08
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/src/org/eclipse/objectteams/otdt/ui/tests/util/TestOptions.java
@@ -0,0 +1,611 @@
+/**********************************************************************
+ * This file is part of "Object Teams Development Tooling"-Software
+ *
+ * Copyright 2004, 2010 Fraunhofer Gesellschaft, Munich, Germany,
+ * for its Fraunhofer Institute and Computer Architecture and Software
+ * Technology (FIRST), Berlin, Germany and Technical University Berlin,
+ * Germany.
+ *
+ * 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
+ * $Id: TestOptions.java 23495 2010-02-05 23:15:16Z stephan $
+ *
+ * Please visit http://www.eclipse.org/objectteams for updates and contact.
+ *
+ * Contributors:
+ * Fraunhofer FIRST - Initial API and implementation
+ * Technical University Berlin - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.objectteams.otdt.ui.tests.util;
+
+import java.util.Hashtable;
+
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
+import org.eclipse.jdt.internal.formatter.align.Alignment;
+import org.eclipse.jdt.internal.ui.JavaPlugin;
+import org.eclipse.jdt.ui.PreferenceConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+public class TestOptions {
+
+ @SuppressWarnings("unchecked")
+ public static Hashtable getFormatterOptions()
+ {
+ Hashtable result= JavaCore.getDefaultOptions();
+ result.putAll(TestFormatterOptions.getSettings());
+ return result;
+ }
+
+ public static void initializeCodeGenerationOptions()
+ {
+ IPreferenceStore store= JavaPlugin.getDefault().getPreferenceStore();
+ store.setValue(PreferenceConstants.CODEGEN_KEYWORD_THIS, false);
+ store.setValue(PreferenceConstants.CODEGEN_IS_FOR_GETTERS, true);
+ store.setValue(PreferenceConstants.CODEGEN_EXCEPTION_VAR_NAME, "e"); //$NON-NLS-1$
+ store.setValue(PreferenceConstants.CODEGEN_ADD_COMMENTS, true);
+ store.setValue(PreferenceConstants.ORGIMPORTS_IMPORTORDER, "java;javax;org;com"); //$NON-NLS-1$
+ store.setValue(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD, 99);
+ store.setValue(PreferenceConstants.ORGIMPORTS_IGNORELOWERCASE, true);
+ }
+}
+
+class TestFormatterOptions
+{
+ public static Hashtable getSettings()
+ {
+ TestFormatterOptions options = new TestFormatterOptions();
+ options.setDefaultSettings();
+ return options.getMap();
+ }
+
+ public int alignment_for_arguments_in_allocation_expression;
+ public int alignment_for_arguments_in_explicit_constructor_call;
+ public int alignment_for_arguments_in_method_invocation;
+ public int alignment_for_arguments_in_qualified_allocation_expression;
+ public int alignment_for_binary_expression;
+ public int alignment_for_compact_if;
+ public int alignment_for_conditional_expression;
+ public int alignment_for_expressions_in_array_initializer;
+ public int alignment_for_multiple_fields;
+ public int alignment_for_parameters_in_constructor_declaration;
+ public int alignment_for_parameters_in_method_declaration;
+ public int alignment_for_selector_in_method_invocation;
+ public int alignment_for_superclass_in_type_declaration;
+ public int alignment_for_superinterfaces_in_type_declaration;
+ public int alignment_for_throws_clause_in_constructor_declaration;
+ public int alignment_for_throws_clause_in_method_declaration;
+
+ public boolean align_type_members_on_columns;
+
+ public String brace_position_for_anonymous_type_declaration;
+ public String brace_position_for_array_initializer;
+ public String brace_position_for_block;
+ public String brace_position_for_block_in_case;
+ public String brace_position_for_constructor_declaration;
+ public String brace_position_for_method_declaration;
+ public String brace_position_for_type_declaration;
+ public String brace_position_for_switch;
+
+ public int continuation_indentation;
+ public int continuation_indentation_for_array_initializer;
+
+ public int blank_lines_after_imports;
+ public int blank_lines_after_package;
+ public int blank_lines_before_field;
+ public int blank_lines_before_first_class_body_declaration;
+ public int blank_lines_before_imports;
+ public int blank_lines_before_member_type;
+ public int blank_lines_before_method;
+ public int blank_lines_before_new_chunk;
+ public int blank_lines_before_package;
+ public int blank_lines_between_type_declarations;
+ public int blank_lines_at_beginning_of_method_body;
+
+ public boolean indent_statements_compare_to_block;
+ public boolean indent_statements_compare_to_body;
+ public boolean indent_body_declarations_compare_to_type_header;
+ public boolean indent_breaks_compare_to_cases;
+ public boolean indent_switchstatements_compare_to_cases;
+ public boolean indent_switchstatements_compare_to_switch;
+
+ public boolean insert_new_line_after_opening_brace_in_array_initializer;
+ public boolean insert_new_line_before_catch_in_try_statement;
+ public boolean insert_new_line_before_closing_brace_in_array_initializer;
+ public boolean insert_new_line_before_else_in_if_statement;
+ public boolean insert_new_line_before_finally_in_try_statement;
+ public boolean insert_new_line_before_while_in_do_statement;
+ public boolean insert_new_line_in_empty_anonymous_type_declaration;
+ public boolean insert_new_line_in_empty_block;
+ public boolean insert_new_line_in_empty_method_body;
+ public boolean insert_new_line_in_empty_type_declaration;
+ public boolean insert_space_after_assignment_operator;
+ public boolean insert_space_after_binary_operator;
+ public boolean insert_space_after_closing_paren_in_cast;
+ public boolean insert_space_after_closing_brace_in_block;
+ public boolean insert_space_after_colon_in_assert;
+ public boolean insert_space_after_colon_in_case;
+ public boolean insert_space_after_colon_in_conditional;
+ public boolean insert_space_after_colon_in_labeled_statement;
+ public boolean insert_space_after_comma_in_allocation_expression;
+ public boolean insert_space_after_comma_in_array_initializer;
+ public boolean insert_space_after_comma_in_constructor_declaration_parameters;
+ public boolean insert_space_after_comma_in_constructor_declaration_throws;
+ public boolean insert_space_after_comma_in_explicit_constructor_call_arguments;
+ public boolean insert_space_after_comma_in_for_increments;
+ public boolean insert_space_after_comma_in_for_inits;
+ public boolean insert_space_after_comma_in_method_invocation_arguments;
+ public boolean insert_space_after_comma_in_method_declaration_parameters;
+ public boolean insert_space_after_comma_in_method_declaration_throws;
+ public boolean insert_space_after_comma_in_multiple_field_declarations;
+ public boolean insert_space_after_comma_in_multiple_local_declarations;
+ public boolean insert_space_after_comma_in_superinterfaces;
+ public boolean insert_space_after_opening_bracket_in_array_allocation_expression;
+ public boolean insert_space_after_opening_bracket_in_array_reference;
+ public boolean insert_space_after_opening_brace_in_array_initializer;
+ public boolean insert_space_after_opening_paren_in_cast;
+ public boolean insert_space_after_opening_paren_in_catch;
+ public boolean insert_space_after_opening_paren_in_constructor_declaration;
+ public boolean insert_space_after_opening_paren_in_for;
+ public boolean insert_space_after_opening_paren_in_if;
+ public boolean insert_space_after_opening_paren_in_method_declaration;
+ public boolean insert_space_after_opening_paren_in_method_invocation;
+ public boolean insert_space_after_opening_paren_in_parenthesized_expression;
+ public boolean insert_space_after_opening_paren_in_switch;
+ public boolean insert_space_after_opening_paren_in_synchronized;
+ public boolean insert_space_after_opening_paren_in_while;
+ public boolean insert_space_after_postfix_operator;
+ public boolean insert_space_after_prefix_operator;
+ public boolean insert_space_after_question_in_conditional;
+ public boolean insert_space_after_semicolon_in_for;
+ public boolean insert_space_after_unary_operator;
+ public boolean insert_space_before_assignment_operator;
+ public boolean insert_space_before_binary_operator;
+ public boolean insert_space_before_closing_brace_in_array_initializer;
+ public boolean insert_space_before_closing_bracket_in_array_allocation_expression;
+ public boolean insert_space_before_closing_bracket_in_array_reference;
+ public boolean insert_space_before_closing_paren_in_cast;
+ public boolean insert_space_before_closing_paren_in_catch;
+ public boolean insert_space_before_closing_paren_in_constructor_declaration;
+ public boolean insert_space_before_closing_paren_in_for;
+ public boolean insert_space_before_closing_paren_in_if;
+ public boolean insert_space_before_closing_paren_in_method_declaration;
+ public boolean insert_space_before_closing_paren_in_method_invocation;
+ public boolean insert_space_before_closing_paren_in_parenthesized_expression;
+ public boolean insert_space_before_closing_paren_in_switch;
+ public boolean insert_space_before_closing_paren_in_synchronized;
+ public boolean insert_space_before_closing_paren_in_while;
+ public boolean insert_space_before_colon_in_assert;
+ public boolean insert_space_before_colon_in_case;
+ public boolean insert_space_before_colon_in_conditional;
+ public boolean insert_space_before_colon_in_default;
+ public boolean insert_space_before_colon_in_labeled_statement;
+ public boolean insert_space_before_comma_in_allocation_expression;
+ public boolean insert_space_before_comma_in_array_initializer;
+ public boolean insert_space_before_comma_in_constructor_declaration_parameters;
+ public boolean insert_space_before_comma_in_constructor_declaration_throws;
+ public boolean insert_space_before_comma_in_explicit_constructor_call_arguments;
+ public boolean insert_space_before_comma_in_for_increments;
+ public boolean insert_space_before_comma_in_for_inits;
+ public boolean insert_space_before_comma_in_method_invocation_arguments;
+ public boolean insert_space_before_comma_in_method_declaration_parameters;
+ public boolean insert_space_before_comma_in_method_declaration_throws;
+ public boolean insert_space_before_comma_in_multiple_field_declarations;
+ public boolean insert_space_before_comma_in_multiple_local_declarations;
+ public boolean insert_space_before_comma_in_superinterfaces;
+ public boolean insert_space_before_opening_brace_in_anonymous_type_declaration;
+ public boolean insert_space_before_opening_brace_in_array_initializer;
+ public boolean insert_space_before_opening_brace_in_block;
+ public boolean insert_space_before_opening_brace_in_constructor_declaration;
+ public boolean insert_space_before_opening_brace_in_method_declaration;
+ public boolean insert_space_before_opening_brace_in_type_declaration;
+ public boolean insert_space_before_opening_bracket_in_array_allocation_expression;
+ public boolean insert_space_before_opening_bracket_in_array_reference;
+ public boolean insert_space_before_opening_bracket_in_array_type_reference;
+ public boolean insert_space_before_opening_paren_in_catch;
+ public boolean insert_space_before_opening_paren_in_constructor_declaration;
+ public boolean insert_space_before_opening_paren_in_for;
+ public boolean insert_space_before_opening_paren_in_if;
+ public boolean insert_space_before_opening_paren_in_method_invocation;
+ public boolean insert_space_before_opening_paren_in_method_declaration;
+ public boolean insert_space_before_opening_paren_in_switch;
+ public boolean insert_space_before_opening_brace_in_switch;
+ public boolean insert_space_before_opening_paren_in_synchronized;
+ public boolean insert_space_before_opening_paren_in_parenthesized_expression;
+ public boolean insert_space_before_opening_paren_in_while;
+ public boolean insert_space_before_postfix_operator;
+ public boolean insert_space_before_prefix_operator;
+ public boolean insert_space_before_question_in_conditional;
+ public boolean insert_space_before_semicolon;
+ public boolean insert_space_before_semicolon_in_for;
+ public boolean insert_space_before_unary_operator;
+ public boolean insert_space_between_brackets_in_array_type_reference;
+ public boolean insert_space_between_empty_braces_in_array_initializer;
+ public boolean insert_space_between_empty_brackets_in_array_allocation_expression;
+ public boolean insert_space_between_empty_parens_in_constructor_declaration;
+ public boolean insert_space_between_empty_parens_in_method_declaration;
+ public boolean insert_space_between_empty_parens_in_method_invocation;
+ public boolean compact_else_if;
+ public boolean keep_guardian_clause_on_one_line;
+ public boolean keep_else_statement_on_same_line;
+ public boolean keep_empty_array_initializer_on_one_line;
+ public boolean keep_simple_if_on_one_line;
+ public boolean keep_then_statement_on_same_line;
+ public int number_of_empty_lines_to_preserve;
+ public boolean put_empty_statement_on_new_line;
+ public int tab_size;
+ public final char filling_space = ' ';
+ public int page_width;
+ public boolean use_tab;
+
+ public int initial_indentation_level;
+ public String line_separator;
+
+ private TestFormatterOptions()
+ {
+ // cannot be instantiated
+ }
+
+ private String getAlignment(int alignment)
+ {
+ return Integer.toString(alignment);
+ }
+
+ @SuppressWarnings("unchecked")
+ private Hashtable getMap()
+ {
+ Hashtable options = new Hashtable();
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION, getAlignment(this.alignment_for_arguments_in_allocation_expression));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL, getAlignment(this.alignment_for_arguments_in_explicit_constructor_call));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION, getAlignment(this.alignment_for_arguments_in_method_invocation));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION, getAlignment(this.alignment_for_arguments_in_qualified_allocation_expression));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION, getAlignment(this.alignment_for_binary_expression));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_IF, getAlignment(this.alignment_for_compact_if));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION, getAlignment(this.alignment_for_conditional_expression));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_ARRAY_INITIALIZER, getAlignment(this.alignment_for_expressions_in_array_initializer));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_MULTIPLE_FIELDS, getAlignment(this.alignment_for_multiple_fields));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION, getAlignment(this.alignment_for_parameters_in_constructor_declaration));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION, getAlignment(this.alignment_for_parameters_in_method_declaration));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION, getAlignment(this.alignment_for_selector_in_method_invocation));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION, getAlignment(this.alignment_for_superclass_in_type_declaration));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION, getAlignment(this.alignment_for_superinterfaces_in_type_declaration));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION, getAlignment(this.alignment_for_throws_clause_in_constructor_declaration));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION, getAlignment(this.alignment_for_throws_clause_in_method_declaration));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS, this.align_type_members_on_columns ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, this.brace_position_for_anonymous_type_declaration);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER, this.brace_position_for_array_initializer);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, this.brace_position_for_block);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK_IN_CASE, this.brace_position_for_block_in_case);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION, this.brace_position_for_constructor_declaration);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION, this.brace_position_for_method_declaration);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION, this.brace_position_for_type_declaration);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, this.brace_position_for_switch);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION, Integer.toString(this.continuation_indentation));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER, Integer.toString(this.continuation_indentation_for_array_initializer));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AFTER_IMPORTS, Integer.toString(this.blank_lines_after_imports));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AFTER_PACKAGE, Integer.toString(this.blank_lines_after_package));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_FIELD, Integer.toString(this.blank_lines_before_field));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_FIRST_CLASS_BODY_DECLARATION, Integer.toString(this.blank_lines_before_first_class_body_declaration));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_IMPORTS, Integer.toString(this.blank_lines_before_imports));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_MEMBER_TYPE, Integer.toString(this.blank_lines_before_member_type));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_METHOD, Integer.toString(this.blank_lines_before_method));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_NEW_CHUNK, Integer.toString(this.blank_lines_before_new_chunk));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BEFORE_PACKAGE, Integer.toString(this.blank_lines_before_package));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_BETWEEN_TYPE_DECLARATIONS, Integer.toString(this.blank_lines_between_type_declarations));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_BLANK_LINES_AT_BEGINNING_OF_METHOD_BODY, Integer.toString(this.blank_lines_at_beginning_of_method_body));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK, this.indent_statements_compare_to_block ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BODY, this.indent_statements_compare_to_body ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_TYPE_HEADER, this.indent_body_declarations_compare_to_type_header ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_BREAKS_COMPARE_TO_CASES, this.indent_breaks_compare_to_cases ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_CASES, this.indent_switchstatements_compare_to_cases ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INDENT_SWITCHSTATEMENTS_COMPARE_TO_SWITCH, this.indent_switchstatements_compare_to_switch ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, this.insert_new_line_after_opening_brace_in_array_initializer? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, this.insert_new_line_before_catch_in_try_statement? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, this.insert_new_line_before_closing_brace_in_array_initializer? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, this.insert_new_line_before_else_in_if_statement? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_FINALLY_IN_TRY_STATEMENT, this.insert_new_line_before_finally_in_try_statement? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, this.insert_new_line_before_while_in_do_statement? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANONYMOUS_TYPE_DECLARATION, this.insert_new_line_in_empty_anonymous_type_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK, this.insert_new_line_in_empty_block? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY, this.insert_new_line_in_empty_method_body? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION, this.insert_new_line_in_empty_type_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR, this.insert_space_after_assignment_operator? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_BINARY_OPERATOR, this.insert_space_after_binary_operator? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST, this.insert_space_after_closing_paren_in_cast? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK, this.insert_space_after_closing_brace_in_block? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_ASSERT, this.insert_space_after_colon_in_assert? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CASE, this.insert_space_after_colon_in_case? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CONDITIONAL, this.insert_space_after_colon_in_conditional? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_LABELED_STATEMENT, this.insert_space_after_colon_in_labeled_statement? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ALLOCATION_EXPRESSION, this.insert_space_after_comma_in_allocation_expression? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ARRAY_INITIALIZER, this.insert_space_after_comma_in_array_initializer? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS, this.insert_space_after_comma_in_constructor_declaration_parameters? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS, this.insert_space_after_comma_in_constructor_declaration_throws? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS, this.insert_space_after_comma_in_explicit_constructor_call_arguments? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INCREMENTS, this.insert_space_after_comma_in_for_increments? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INITS, this.insert_space_after_comma_in_for_inits? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, this.insert_space_after_comma_in_method_invocation_arguments? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS, this.insert_space_after_comma_in_method_declaration_parameters? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS, this.insert_space_after_comma_in_method_declaration_throws? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS, this.insert_space_after_comma_in_multiple_field_declarations? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS, this.insert_space_after_comma_in_multiple_local_declarations? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_SUPERINTERFACES, this.insert_space_after_comma_in_superinterfaces? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION, this.insert_space_after_opening_bracket_in_array_allocation_expression? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET_IN_ARRAY_REFERENCE, this.insert_space_after_opening_bracket_in_array_reference? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, this.insert_space_after_opening_brace_in_array_initializer? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CAST, this.insert_space_after_opening_paren_in_cast? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CATCH, this.insert_space_after_opening_paren_in_catch? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION, this.insert_space_after_opening_paren_in_constructor_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR, this.insert_space_after_opening_paren_in_for? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF, this.insert_space_after_opening_paren_in_if? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION, this.insert_space_after_opening_paren_in_method_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, this.insert_space_after_opening_paren_in_method_invocation? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, this.insert_space_after_opening_paren_in_parenthesized_expression? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH, this.insert_space_after_opening_paren_in_switch? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SYNCHRONIZED, this.insert_space_after_opening_paren_in_synchronized? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_WHILE, this.insert_space_after_opening_paren_in_while? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_POSTFIX_OPERATOR, this.insert_space_after_postfix_operator? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR, this.insert_space_after_prefix_operator? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_CONDITIONAL, this.insert_space_after_question_in_conditional? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR, this.insert_space_after_semicolon_in_for? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_UNARY_OPERATOR, this.insert_space_after_unary_operator? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR, this.insert_space_before_assignment_operator? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR, this.insert_space_before_binary_operator? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, this.insert_space_before_closing_brace_in_array_initializer? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION, this.insert_space_before_closing_bracket_in_array_allocation_expression? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_REFERENCE, this.insert_space_before_closing_bracket_in_array_reference? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST, this.insert_space_before_closing_paren_in_cast? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CATCH, this.insert_space_before_closing_paren_in_catch? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CONSTRUCTOR_DECLARATION, this.insert_space_before_closing_paren_in_constructor_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR, this.insert_space_before_closing_paren_in_for? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF, this.insert_space_before_closing_paren_in_if? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION, this.insert_space_before_closing_paren_in_method_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, this.insert_space_before_closing_paren_in_method_invocation? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION, this.insert_space_before_closing_paren_in_parenthesized_expression? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH, this.insert_space_before_closing_paren_in_switch? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SYNCHRONIZED, this.insert_space_before_closing_paren_in_synchronized? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_WHILE, this.insert_space_before_closing_paren_in_while? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_ASSERT, this.insert_space_before_colon_in_assert? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CASE, this.insert_space_before_colon_in_case? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CONDITIONAL, this.insert_space_before_colon_in_conditional? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_DEFAULT, this.insert_space_before_colon_in_default? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_LABELED_STATEMENT, this.insert_space_before_colon_in_labeled_statement? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION, this.insert_space_before_comma_in_allocation_expression? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ARRAY_INITIALIZER, this.insert_space_before_comma_in_array_initializer? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS, this.insert_space_before_comma_in_constructor_declaration_parameters? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS, this.insert_space_before_comma_in_constructor_declaration_throws? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS, this.insert_space_before_comma_in_explicit_constructor_call_arguments? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS, this.insert_space_before_comma_in_for_increments? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS, this.insert_space_before_comma_in_for_inits? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, this.insert_space_before_comma_in_method_invocation_arguments? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS, this.insert_space_before_comma_in_method_declaration_parameters? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS, this.insert_space_before_comma_in_method_declaration_throws? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS, this.insert_space_before_comma_in_multiple_field_declarations? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS, this.insert_space_before_comma_in_multiple_local_declarations? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES, this.insert_space_before_comma_in_superinterfaces? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANONYMOUS_TYPE_DECLARATION, this.insert_space_before_opening_brace_in_anonymous_type_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER, this.insert_space_before_opening_brace_in_array_initializer? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK, this.insert_space_before_opening_brace_in_block? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_CONSTRUCTOR_DECLARATION, this.insert_space_before_opening_brace_in_constructor_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION, this.insert_space_before_opening_brace_in_method_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION, this.insert_space_before_opening_brace_in_type_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION, this.insert_space_before_opening_bracket_in_array_allocation_expression ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_REFERENCE, this.insert_space_before_opening_bracket_in_array_reference? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_TYPE_REFERENCE, this.insert_space_before_opening_bracket_in_array_type_reference? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CATCH, this.insert_space_before_opening_paren_in_catch? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION, this.insert_space_before_opening_paren_in_constructor_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR, this.insert_space_before_opening_paren_in_for? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF, this.insert_space_before_opening_paren_in_if? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION, this.insert_space_before_opening_paren_in_method_invocation? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION, this.insert_space_before_opening_paren_in_method_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH, this.insert_space_before_opening_paren_in_switch? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH, this.insert_space_before_opening_brace_in_switch? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SYNCHRONIZED, this.insert_space_before_opening_paren_in_synchronized? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, this.insert_space_before_opening_paren_in_parenthesized_expression? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_WHILE, this.insert_space_before_opening_paren_in_while? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR, this.insert_space_before_postfix_operator? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR, this.insert_space_before_prefix_operator? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_CONDITIONAL, this.insert_space_before_question_in_conditional? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON, this.insert_space_before_semicolon? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_FOR, this.insert_space_before_semicolon_in_for? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR, this.insert_space_before_unary_operator? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_BRACKETS_IN_ARRAY_TYPE_REFERENCE, this.insert_space_between_brackets_in_array_type_reference? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_ARRAY_INITIALIZER, this.insert_space_between_empty_braces_in_array_initializer? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS_IN_ARRAY_ALLOCATION_EXPRESSION, this.insert_space_between_empty_brackets_in_array_allocation_expression? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_CONSTRUCTOR_DECLARATION, this.insert_space_between_empty_parens_in_constructor_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION, this.insert_space_between_empty_parens_in_method_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION, this.insert_space_between_empty_parens_in_method_invocation? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_COMPACT_ELSE_IF, this.compact_else_if ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_GUARDIAN_CLAUSE_ON_ONE_LINE, this.keep_guardian_clause_on_one_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE, this.keep_else_statement_on_same_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_EMPTY_ARRAY_INITIALIZER_ON_ONE_LINE, this.keep_empty_array_initializer_on_one_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_SIMPLE_IF_ON_ONE_LINE, this.keep_simple_if_on_one_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_THEN_STATEMENT_ON_SAME_LINE, this.keep_then_statement_on_same_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_NUMBER_OF_EMPTY_LINES_TO_PRESERVE, Integer.toString(this.number_of_empty_lines_to_preserve));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE, this.put_empty_statement_on_new_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, Integer.toString(this.page_width));
+ options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, this.use_tab ? JavaCore.TAB: JavaCore.SPACE);
+ options.put(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, Integer.toString(this.tab_size));
+ return options;
+ }
+
+ private void setDefaultSettings()
+ {
+ this.alignment_for_arguments_in_allocation_expression = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_arguments_in_explicit_constructor_call = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_arguments_in_method_invocation = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_arguments_in_qualified_allocation_expression = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_binary_expression = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_compact_if = Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_INDENT_BY_ONE;
+ this.alignment_for_conditional_expression = Alignment.M_ONE_PER_LINE_SPLIT;
+ this.alignment_for_expressions_in_array_initializer = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_multiple_fields = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_parameters_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_parameters_in_method_declaration = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_selector_in_method_invocation = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_superclass_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
+ this.alignment_for_superinterfaces_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
+ this.alignment_for_throws_clause_in_constructor_declaration = Alignment.M_COMPACT_SPLIT;
+ this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
+ this.align_type_members_on_columns = false;
+ this.brace_position_for_anonymous_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
+ this.brace_position_for_array_initializer = DefaultCodeFormatterConstants.END_OF_LINE;
+ this.brace_position_for_block = DefaultCodeFormatterConstants.END_OF_LINE;
+ this.brace_position_for_block_in_case = DefaultCodeFormatterConstants.END_OF_LINE;
+ this.brace_position_for_constructor_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
+//{ObjectTeams: according to code conventions of Fraunhofer FIRST
+ this.brace_position_for_method_declaration = DefaultCodeFormatterConstants.NEXT_LINE;
+//gbr}
+ this.brace_position_for_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
+ this.brace_position_for_switch = DefaultCodeFormatterConstants.END_OF_LINE;
+ this.continuation_indentation = 2;
+ this.continuation_indentation_for_array_initializer = 2;
+ this.blank_lines_after_imports = 0;
+ this.blank_lines_after_package = 0;
+ this.blank_lines_before_field = 0;
+ this.blank_lines_before_first_class_body_declaration = 0;
+ this.blank_lines_before_imports = 0;
+ this.blank_lines_before_member_type = 0;
+ this.blank_lines_before_method = 0;
+ this.blank_lines_before_new_chunk = 0;
+ this.blank_lines_before_package = 0;
+ this.blank_lines_between_type_declarations = 0;
+ this.blank_lines_at_beginning_of_method_body = 0;
+ this.indent_statements_compare_to_block = true;
+ this.indent_statements_compare_to_body = true;
+ this.indent_body_declarations_compare_to_type_header = true;
+ this.indent_breaks_compare_to_cases = true;
+ this.indent_switchstatements_compare_to_cases = true;
+ this.indent_switchstatements_compare_to_switch = true;
+ this.insert_new_line_after_opening_brace_in_array_initializer = false;
+ this.insert_new_line_before_catch_in_try_statement = false;
+ this.insert_new_line_before_closing_brace_in_array_initializer = false;
+ this.insert_new_line_before_else_in_if_statement = false;
+ this.insert_new_line_before_finally_in_try_statement = false;
+ this.insert_new_line_before_while_in_do_statement = false;
+ this.insert_new_line_in_empty_anonymous_type_declaration = true;
+ this.insert_new_line_in_empty_block = true;
+ this.insert_new_line_in_empty_method_body = true;
+ this.insert_new_line_in_empty_type_declaration = true;
+ this.insert_space_after_assignment_operator = true;
+ this.insert_space_after_binary_operator = true;
+ this.insert_space_after_closing_paren_in_cast = true;
+ this.insert_space_after_closing_brace_in_block = true;
+ this.insert_space_after_colon_in_assert = true;
+ this.insert_space_after_colon_in_case = true;
+ this.insert_space_after_colon_in_conditional = true;
+ this.insert_space_after_colon_in_labeled_statement = true;
+ this.insert_space_after_comma_in_allocation_expression = true;
+ this.insert_space_after_comma_in_array_initializer = true;
+ this.insert_space_after_comma_in_constructor_declaration_parameters = true;
+ this.insert_space_after_comma_in_constructor_declaration_throws = true;
+ this.insert_space_after_comma_in_explicit_constructor_call_arguments = true;
+ this.insert_space_after_comma_in_for_increments = true;
+ this.insert_space_after_comma_in_for_inits = true;
+ this.insert_space_after_comma_in_method_invocation_arguments = true;
+ this.insert_space_after_comma_in_method_declaration_parameters = true;
+ this.insert_space_after_comma_in_method_declaration_throws = true;
+ this.insert_space_after_comma_in_multiple_field_declarations = true;
+ this.insert_space_after_comma_in_multiple_local_declarations = true;
+ this.insert_space_after_comma_in_superinterfaces = true;
+ this.insert_space_after_opening_bracket_in_array_allocation_expression = false;
+ this.insert_space_after_opening_bracket_in_array_reference = false;
+ this.insert_space_after_opening_brace_in_array_initializer = false;
+ this.insert_space_after_opening_paren_in_cast = false;
+ this.insert_space_after_opening_paren_in_catch = false;
+ this.insert_space_after_opening_paren_in_constructor_declaration = false;
+ this.insert_space_after_opening_paren_in_for = false;
+ this.insert_space_after_opening_paren_in_if = false;
+ this.insert_space_after_opening_paren_in_method_declaration = false;
+ this.insert_space_after_opening_paren_in_method_invocation = false;
+ this.insert_space_after_opening_paren_in_parenthesized_expression = false;
+ this.insert_space_after_opening_paren_in_switch = false;
+ this.insert_space_after_opening_paren_in_synchronized = false;
+ this.insert_space_after_opening_paren_in_while = false;
+ this.insert_space_after_postfix_operator = false;
+ this.insert_space_after_prefix_operator = false;
+ this.insert_space_after_question_in_conditional = true;
+ this.insert_space_after_semicolon_in_for = true;
+ this.insert_space_after_unary_operator = false;
+ this.insert_space_before_assignment_operator = true;
+ this.insert_space_before_binary_operator = true;
+ this.insert_space_before_closing_brace_in_array_initializer = false;
+ this.insert_space_before_closing_bracket_in_array_allocation_expression = false;
+ this.insert_space_before_closing_bracket_in_array_reference = false;
+ this.insert_space_before_closing_paren_in_cast = false;
+ this.insert_space_before_closing_paren_in_catch = false;
+ this.insert_space_before_closing_paren_in_constructor_declaration = false;
+ this.insert_space_before_closing_paren_in_for = false;
+ this.insert_space_before_closing_paren_in_if = false;
+ this.insert_space_before_closing_paren_in_method_declaration = false;
+ this.insert_space_before_closing_paren_in_method_invocation = false;
+ this.insert_space_before_closing_paren_in_parenthesized_expression = false;
+ this.insert_space_before_closing_paren_in_switch = false;
+ this.insert_space_before_closing_paren_in_synchronized = false;
+ this.insert_space_before_closing_paren_in_while = false;
+ this.insert_space_before_colon_in_assert = true;
+ this.insert_space_before_colon_in_case = true;
+ this.insert_space_before_colon_in_conditional = true;
+ this.insert_space_before_colon_in_default = true;
+ this.insert_space_before_colon_in_labeled_statement = true;
+ this.insert_space_before_comma_in_allocation_expression = false;
+ this.insert_space_before_comma_in_array_initializer = false;
+ this.insert_space_before_comma_in_constructor_declaration_parameters = false;
+ this.insert_space_before_comma_in_constructor_declaration_throws = false;
+ this.insert_space_before_comma_in_explicit_constructor_call_arguments = false;
+ this.insert_space_before_comma_in_for_increments = false;
+ this.insert_space_before_comma_in_for_inits = false;
+ this.insert_space_before_comma_in_method_invocation_arguments = false;
+ this.insert_space_before_comma_in_method_declaration_parameters = false;
+ this.insert_space_before_comma_in_method_declaration_throws = false;
+ this.insert_space_before_comma_in_multiple_field_declarations = false;
+ this.insert_space_before_comma_in_multiple_local_declarations = false;
+ this.insert_space_before_comma_in_superinterfaces = false;
+ this.insert_space_before_opening_brace_in_anonymous_type_declaration = true;
+ this.insert_space_before_opening_brace_in_array_initializer = false;
+ this.insert_space_before_opening_brace_in_block = true;
+ this.insert_space_before_opening_brace_in_constructor_declaration = true;
+ this.insert_space_before_opening_brace_in_method_declaration = true;
+ this.insert_space_before_opening_brace_in_switch = true;
+ this.insert_space_before_opening_brace_in_type_declaration = true;
+ this.insert_space_before_opening_bracket_in_array_allocation_expression = false;
+ this.insert_space_before_opening_bracket_in_array_reference = false;
+ this.insert_space_before_opening_bracket_in_array_type_reference = false;
+ this.insert_space_before_opening_paren_in_catch = true;
+ this.insert_space_before_opening_paren_in_constructor_declaration = false;
+ this.insert_space_before_opening_paren_in_for = true;
+ this.insert_space_before_opening_paren_in_if = true;
+ this.insert_space_before_opening_paren_in_method_invocation = false;
+ this.insert_space_before_opening_paren_in_method_declaration = false;
+ this.insert_space_before_opening_paren_in_switch = true;
+ this.insert_space_before_opening_paren_in_synchronized = true;
+ this.insert_space_before_opening_paren_in_parenthesized_expression = false;
+ this.insert_space_before_opening_paren_in_while = true;
+ this.insert_space_before_postfix_operator = false;
+ this.insert_space_before_prefix_operator = false;
+ this.insert_space_before_question_in_conditional = true;
+ this.insert_space_before_semicolon = false;
+ this.insert_space_before_semicolon_in_for = false;
+ this.insert_space_before_unary_operator = false;
+ this.insert_space_between_brackets_in_array_type_reference = false;
+ this.insert_space_between_empty_braces_in_array_initializer = false;
+ this.insert_space_between_empty_brackets_in_array_allocation_expression = false;
+ this.insert_space_between_empty_parens_in_constructor_declaration = false;
+ this.insert_space_between_empty_parens_in_method_declaration = false;
+ this.insert_space_between_empty_parens_in_method_invocation = false;
+ this.compact_else_if = true;
+ this.keep_guardian_clause_on_one_line = false;
+ this.keep_else_statement_on_same_line = false;
+ this.keep_empty_array_initializer_on_one_line = false;
+ this.keep_simple_if_on_one_line = false;
+ this.keep_then_statement_on_same_line = false;
+ this.number_of_empty_lines_to_preserve = 1;
+ this.put_empty_statement_on_new_line = false;
+ this.tab_size = 4;
+ this.page_width = 80;
+ this.use_tab = true; // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=49081
+ }
+}
+
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/test.xml b/testplugins/org.eclipse.objectteams.otdt.ui.tests/test.xml
new file mode 100644
index 000000000..47d6fd599
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/test.xml
@@ -0,0 +1,66 @@
+<project name="testsuite" default="run" basedir=".">
+
+ <property name="otdt-tests-workspace" value="${test.eclipseDir}/otdt-tests-workspace"/>
+
+ <!-- sets the properties eclipseTest-home, and library-file -->
+ <property name="plugin-name" value="org.eclipse.objectteams.otdt.ui.tests"/>
+
+ <!-- library.xml need these properties-->
+ <property name="eclipse-home" value="${test.eclipseDir}"/>
+ <property name="test.target" value="performance"/>
+
+ <property name="library-file" value="${test.eclipseDir}/plugins/${org.eclipse.test}/library.xml"/>
+
+ <!-- This target holds all initialization code that needs to be done for -->
+ <!-- all tests that are to be run. Initialization for individual tests -->
+ <!-- should be done within the body of the suite target. -->
+ <target name="init">
+ <tstamp/>
+ <delete>
+ <fileset dir="${test.eclipseDir}" includes="org.eclipse.objectteams.otdt.ui.tests.AllTests.xml,${plugin-name}.${file-id}.xml"/>
+ </delete>
+ </target>
+
+ <!-- This target defines the tests that need to be run. -->
+ <target name="suite">
+
+ <!-- All OTDT UI tests -->
+ <property name="otdt-ui-folder"
+ value="${otdt-tests-workspace}/otdt-ui-folder"/>
+ <delete dir="${otdt-ui-folder}" quiet="true"/>
+
+ <ant target="ui-test" antfile="${library-file}" dir="${test.eclipseDir}">
+ <property name="data-dir" value="${otdt-ui-folder}"/>
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname"
+ value="org.eclipse.objectteams.otdt.ui.tests.AllTests"/>
+ </ant>
+ </target>
+
+
+
+ <target name="checkOS">
+ <condition property="os.isWindows">
+ <os family="windows"/>
+ </condition>
+ </target>
+
+ <!-- This target holds code to cleanup the testing environment after -->
+ <!-- after all of the tests have been run. You can use this target to -->
+ <!-- delete temporary files that have been created. -->
+ <target name="cleanup">
+
+ </target>
+
+ <!-- This target runs the test suite. Any actions that need to happen -->
+ <!-- after all the tests have been run should go here. -->
+ <target name="run" depends="init,suite,cleanup">
+<!--
+ <ant target="collect" antfile="${library-file}" dir="${test.eclipseDir}">
+ <property name="includes" value="org.eclipse.objectteams.otdt.ui.tests.AllTests.xml"/>
+ <property name="output-file" value="${plugin-name}.${file-id}.xml"/>
+ </ant>
+-->
+ </target>
+
+</project>
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/.classpath b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/.classpath
new file mode 100644
index 000000000..72bc4744d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
+ <classpathentry kind="var" path="OTDT_INSTALLDIR/lib/otre.jar"/>
+</classpath>
+
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/.project b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/.project
new file mode 100644
index 000000000..906d5fd1e
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/.project
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>CallinMarker</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/bar/BaseTeam.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/bar/BaseTeam.java
new file mode 100644
index 000000000..0c3d462ba
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/bar/BaseTeam.java
@@ -0,0 +1,9 @@
+package bar;
+
+public team class BaseTeam {
+ protected class R playedBy MissingBase {
+ somethingElse <- replace toString;
+ void somethingElse () {}
+ }
+ public void murx() {}
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/bar/TeamTeam.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/bar/TeamTeam.java
new file mode 100644
index 000000000..bd3c3d364
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/bar/TeamTeam.java
@@ -0,0 +1,7 @@
+package bar;
+public team class TeamTeam {
+ protected class TR playedBy BaseTeam {
+ void nix() {}
+ nix <- after murx;
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/cycle/Base1.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/cycle/Base1.java
new file mode 100644
index 000000000..4ca1b9ac7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/cycle/Base1.java
@@ -0,0 +1,9 @@
+package cycle;
+public class Base1 {
+ public static class Inner {
+ void foo() {}
+ static class Leaf extends Inner {
+ @Override void foo() {}
+ }
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/cycle/CTeam.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/cycle/CTeam.java
new file mode 100644
index 000000000..e7599e1c1
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/cycle/CTeam.java
@@ -0,0 +1,8 @@
+package cycle;
+import base cycle.Base1.Inner;
+public team class CTeam {
+ protected class R playedBy Inner {
+ void nop() {}
+ nop <- after foo;
+ }
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/Main.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/Main.java
new file mode 100644
index 000000000..85583f63d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/Main.java
@@ -0,0 +1,14 @@
+package foo;
+
+public class Main {
+
+ public static void main(String[] args) {
+// MyTeam t = new MyTeam();
+// t.activate();
+ MyBase b = new MyBase();
+ b.baseMethod();
+ b.bm2();
+ b.bm3();
+ b.bm4();
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyBase.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyBase.java
new file mode 100644
index 000000000..9c09b17f6
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyBase.java
@@ -0,0 +1,24 @@
+package foo;
+
+public class MyBase {
+
+ public void baseMethod() {
+ System.out.println("baseMethod");
+ }
+
+ public void bm2() {
+ System.out.println("bm2");
+ }
+
+ public void bm3() {
+ System.out.println("bm3");
+ }
+
+ public void foobar() {
+ System.out.println("MyBase.foobar()");
+ }
+
+ public void bm4() {
+ System.out.println("MyBase.bm4()");
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyTeam.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyTeam.java
new file mode 100644
index 000000000..c7608a475
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyTeam.java
@@ -0,0 +1,35 @@
+package foo;
+
+public team class MyTeam {
+
+ public class R1 playedBy MyBase
+ {
+ public void foo1()
+ {
+ System.out.println("R1.foo()");
+ }
+
+ public void foo2()
+ {
+ System.out.println("R1.foo2()");
+ }
+
+ public void foo3()
+ {
+ System.out.println("R1.foo3()");
+ }
+
+ foo1 <- after baseMethod;
+ }
+
+ public class R2 extends R1
+ {
+ public void foobar1()
+ {
+ System.out.println("R2.foobar1()");
+ }
+
+ foo2 <- after bm2;
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyTeam2.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyTeam2.java
new file mode 100644
index 000000000..14d6b9b56
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyTeam2.java
@@ -0,0 +1,10 @@
+package foo;
+
+public team class MyTeam2 extends MyTeam {
+
+ public class R1
+ {
+ foo3 <- after bm3;
+ }
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyTeam2/R2.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyTeam2/R2.java
new file mode 100644
index 000000000..7601b22bb
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CallinMarker/src/foo/MyTeam2/R2.java
@@ -0,0 +1,10 @@
+team package foo.MyTeam2;
+
+public class R2 {
+ R2()
+ {
+ base();
+ }
+
+ foobar1 <- after bm4;
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/.classpath b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/.classpath
new file mode 100644
index 000000000..db005f89b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/.classpath
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="teams"/>
+ <classpathentry kind="src" path="internaldefinedrole"/>
+ <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
+ <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="lib" sourcepath="src" path="bins"/>
+
+ <classpathentry kind="var" path="OTDT_INSTALLDIR/lib/otre.jar"/>
+</classpath>
+
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/.project b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/.project
new file mode 100644
index 000000000..bf5f8304c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/.project
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>CreationTestProject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/ordinarypkg/EmptyClass.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/ordinarypkg/EmptyClass.java
new file mode 100644
index 000000000..2ee3c3a3d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/ordinarypkg/EmptyClass.java
@@ -0,0 +1,10 @@
+package ordinarypkg;
+
+/**
+ * @author kaschja
+ * @version $Id: EmptyClass.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class EmptyClass
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/ordinarypkg/InterfaceWithOneMethod.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/ordinarypkg/InterfaceWithOneMethod.java
new file mode 100644
index 000000000..cca7529ff
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/ordinarypkg/InterfaceWithOneMethod.java
@@ -0,0 +1,10 @@
+package ordinarypkg;
+
+/**
+ * @author kaschja
+ * @version $Id: InterfaceWithOneMethod.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public interface InterfaceWithOneMethod
+{
+ public abstract void methodToImplement();
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/ordinarypkg/InterfaceWithTwoMethods.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/ordinarypkg/InterfaceWithTwoMethods.java
new file mode 100644
index 000000000..100e574e1
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/ordinarypkg/InterfaceWithTwoMethods.java
@@ -0,0 +1,11 @@
+package ordinarypkg;
+
+/**
+ * @author kaschja
+ * @version
+ */
+public interface InterfaceWithTwoMethods
+{
+ public abstract void methodToImplementA();
+ public abstract void methodToImplementB();
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/AbstractTeamWithAbstractMethod.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/AbstractTeamWithAbstractMethod.java
new file mode 100644
index 000000000..9f9b36315
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/AbstractTeamWithAbstractMethod.java
@@ -0,0 +1,10 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: AbstractTeamWithAbstractMethod.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public abstract team class AbstractTeamWithAbstractMethod
+{
+ public abstract void methodToImplement();
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/EmptyBaseTeam.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/EmptyBaseTeam.java
new file mode 100644
index 000000000..095cb7133
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/EmptyBaseTeam.java
@@ -0,0 +1,10 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: EmptyBaseTeam.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class EmptyBaseTeam
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyEmpty.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyEmpty.java
new file mode 100644
index 000000000..584956935
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyEmpty.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version
+ */
+public team class TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyEmpty extends TeamWithRoleWithAbstractMethod
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyWithOneRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyWithOneRole.java
new file mode 100644
index 000000000..18617bc5d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyWithOneRole.java
@@ -0,0 +1,13 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version
+ */
+public team class TeamForRoleWithExplicitSuperclassAndInheritedMethod_PreviouslyWithOneRole
+{
+ public abstract class RoleWithAbstractMethod
+ {
+ public abstract void methodToImplement1();
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclass_PreviouslyEmpty.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclass_PreviouslyEmpty.java
new file mode 100644
index 000000000..4372fb230
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclass_PreviouslyEmpty.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version
+ */
+public team class TeamForRoleWithExplicitSuperclass_PreviouslyEmpty extends TeamWithRoleWithAbstractMethod
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclass_PreviouslyWithOneRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclass_PreviouslyWithOneRole.java
new file mode 100644
index 000000000..c9f09e898
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithExplicitSuperclass_PreviouslyWithOneRole.java
@@ -0,0 +1,10 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version
+ */
+public team class TeamForRoleWithExplicitSuperclass_PreviouslyWithOneRole
+{
+ public class SuperRole {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithImplicitSuperClassAndInheritedMethod.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithImplicitSuperClassAndInheritedMethod.java
new file mode 100644
index 000000000..bd023b2a9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithImplicitSuperClassAndInheritedMethod.java
@@ -0,0 +1,10 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: TeamForRoleWithImplicitSuperClassAndInheritedMethod.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamForRoleWithImplicitSuperClassAndInheritedMethod extends TeamWithRoleWithAbstractMethod
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithOneSuperInterface.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithOneSuperInterface.java
new file mode 100644
index 000000000..fba8262a0
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithOneSuperInterface.java
@@ -0,0 +1,10 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: TeamForRoleWithOneSuperInterface.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamForRoleWithOneSuperInterface
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithOneSuperInterfaceAndInheritedMethod.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithOneSuperInterfaceAndInheritedMethod.java
new file mode 100644
index 000000000..a293774ef
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithOneSuperInterfaceAndInheritedMethod.java
@@ -0,0 +1,10 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: TeamForRoleWithOneSuperInterfaceAndInheritedMethod.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamForRoleWithOneSuperInterfaceAndInheritedMethod
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithOrdinaryBase.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithOrdinaryBase.java
new file mode 100644
index 000000000..a2ba9f340
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithOrdinaryBase.java
@@ -0,0 +1,10 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: TeamForRoleWithOrdinaryBase.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamForRoleWithOrdinaryBase
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithSeveralSuperInterfaces.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithSeveralSuperInterfaces.java
new file mode 100644
index 000000000..cc282d2c3
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithSeveralSuperInterfaces.java
@@ -0,0 +1,10 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: TeamForRoleWithSeveralSuperInterfaces.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamForRoleWithSeveralSuperInterfaces
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithSeveralSuperInterfacesAndInheritedMethods.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithSeveralSuperInterfacesAndInheritedMethods.java
new file mode 100644
index 000000000..19fced3fe
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithSeveralSuperInterfacesAndInheritedMethods.java
@@ -0,0 +1,10 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: TeamForRoleWithSeveralSuperInterfacesAndInheritedMethods.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamForRoleWithSeveralSuperInterfacesAndInheritedMethods
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithSeveralSuperTypesAndInheritedMethods.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithSeveralSuperTypesAndInheritedMethods.java
new file mode 100644
index 000000000..758c27f9d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithSeveralSuperTypesAndInheritedMethods.java
@@ -0,0 +1,13 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: TeamForRoleWithSeveralSuperTypesAndInheritedMethods.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamForRoleWithSeveralSuperTypesAndInheritedMethods extends TeamWithRoleWithAbstractMethod
+{
+ public abstract class AbstractSuperRole
+ {
+ public abstract void methodToImplementX();
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithTeamBase.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithTeamBase.java
new file mode 100644
index 000000000..b78253a74
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForRoleWithTeamBase.java
@@ -0,0 +1,10 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: TeamForRoleWithTeamBase.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamForRoleWithTeamBase
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForSimpleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForSimpleRole.java
new file mode 100644
index 000000000..cb657b7d1
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForSimpleRole.java
@@ -0,0 +1,10 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: TeamForSimpleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamForSimpleRole
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForSimpleRole_PreviouslyWithOneRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForSimpleRole_PreviouslyWithOneRole.java
new file mode 100644
index 000000000..657d376a8
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForSimpleRole_PreviouslyWithOneRole.java
@@ -0,0 +1,10 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: TeamForSimpleRole_PreviouslyWithOneRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamForSimpleRole_PreviouslyWithOneRole
+{
+ public class PreviouslyExistingRoleClass {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForSimpleRole_PreviouslyWithTwoRoles.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForSimpleRole_PreviouslyWithTwoRoles.java
new file mode 100644
index 000000000..f4dd822e8
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamForSimpleRole_PreviouslyWithTwoRoles.java
@@ -0,0 +1,12 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: TeamForSimpleRole_PreviouslyWithTwoRoles.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamForSimpleRole_PreviouslyWithTwoRoles
+{
+ public class PreviouslyExistingRoleClassA {}
+
+ public class PreviouslyExistingRoleClassB {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamWithRoleWithAbstractMethod.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamWithRoleWithAbstractMethod.java
new file mode 100644
index 000000000..dff1fecb2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/internaldefinedrole/teampkg/TeamWithRoleWithAbstractMethod.java
@@ -0,0 +1,13 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: TeamWithRoleWithAbstractMethod.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamWithRoleWithAbstractMethod
+{
+ public abstract class RoleWithAbstractMethod
+ {
+ public abstract void methodToImplement1();
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/teams/ordinarypkg/InterfaceWithOneMethod.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/teams/ordinarypkg/InterfaceWithOneMethod.java
new file mode 100644
index 000000000..28484b395
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/teams/ordinarypkg/InterfaceWithOneMethod.java
@@ -0,0 +1,10 @@
+package ordinarypkg;
+
+/**
+ * @author kaschja
+ * @version
+ */
+public interface InterfaceWithOneMethod
+{
+ public abstract void methodToImplement();
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/teams/teampkg/AbstractTeamWithAbstractMethod.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/teams/teampkg/AbstractTeamWithAbstractMethod.java
new file mode 100644
index 000000000..d6cf2aab2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/teams/teampkg/AbstractTeamWithAbstractMethod.java
@@ -0,0 +1,10 @@
+package teampkg;
+
+/**
+ * @author kaschja
+ * @version $Id: AbstractTeamWithAbstractMethod.java 5885 2005-06-13 14:04:51Z anklam $
+ */
+public abstract team class AbstractTeamWithAbstractMethod
+{
+ public abstract void methodToImplement();
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/teams/teampkg/TeamForNestedTeam.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/teams/teampkg/TeamForNestedTeam.java
new file mode 100644
index 000000000..dedbcd8c8
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/CreationTestProject/teams/teampkg/TeamForNestedTeam.java
@@ -0,0 +1,5 @@
+package teampkg;
+
+public team class TeamForNestedTeam {
+ // empty
+} \ No newline at end of file
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/.classpath b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/.classpath
new file mode 100644
index 000000000..a5d9fdf8d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/.classpath
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="unbound"/>
+ <classpathentry kind="src" path="boundtoordinary"/>
+ <classpathentry kind="src" path="boundtoteam"/>
+ <classpathentry kind="src" path="bound/toteam"/>
+ <classpathentry kind="src" path="bound/toordinary"/>
+ <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
+ <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="lib" sourcepath="src" path="bins"/>
+
+ <classpathentry kind="var" path="OTDT_INSTALLDIR/lib/otre.jar"/>
+</classpath>
+
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/.project b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/.project
new file mode 100644
index 000000000..a9197a70e
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/.project
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>ExternalDefinedRole</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/basepkg/SampleBase.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/basepkg/SampleBase.java
new file mode 100644
index 000000000..dc8ce1008
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/basepkg/SampleBase.java
@@ -0,0 +1,9 @@
+package basepkg;
+
+/**
+ * $Id: SampleBase.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleBase
+{
+ public void baseMethod() {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_1.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_1.java
new file mode 100644
index 000000000..3aaab4aac
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_1.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_1.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_1
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_1/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_1/SampleRole.java
new file mode 100644
index 000000000..2c8ca51ff
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_1/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_1;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy basepkg.SampleBase
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_2.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_2.java
new file mode 100644
index 000000000..4b3e03ac7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_2.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_2.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_2
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_2/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_2/SampleRole.java
new file mode 100644
index 000000000..c8742261f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_2/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_2;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy basepkg.SampleBase
+{
+ public String roleAttr = 'AStringAttribut';
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3a.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3a.java
new file mode 100644
index 000000000..cffaab65d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3a.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_3a.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_3a
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3a/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3a/SampleRole.java
new file mode 100644
index 000000000..9312cc5d8
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3a/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_3a;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy basepkg.SampleBase
+{
+ public void roleMethod() {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3b.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3b.java
new file mode 100644
index 000000000..2fd7ad66f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3b.java
@@ -0,0 +1,8 @@
+package teampkg;
+
+/**
+ * $Id: Team_3b.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_3b
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3b/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3b/SampleRole.java
new file mode 100644
index 000000000..5a092a8a2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3b/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_3b;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy basepkg.SampleBase
+{
+ public void roleMethod(String paraObj) {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3c.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3c.java
new file mode 100644
index 000000000..844506c2a
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3c.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_3c.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_3c
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3c/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3c/SampleRole.java
new file mode 100644
index 000000000..db4f4fb3d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3c/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_3c;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy basepkg.SampleBase
+{
+ public String roleMethod() {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3d.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3d.java
new file mode 100644
index 000000000..d0fdfed29
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3d.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_3d.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_3d
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3d/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3d/SampleRole.java
new file mode 100644
index 000000000..107695e95
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_3d/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_3d;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy basepkg.SampleBase
+{
+ public void roleMethod() throws Exception {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4a.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4a.java
new file mode 100644
index 000000000..b6243f881
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4a.java
@@ -0,0 +1,8 @@
+package teampkg;
+
+/**
+ * $Id: Team_4a.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_4a
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4a/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4a/SampleRole.java
new file mode 100644
index 000000000..64d0a4c0f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4a/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_4a;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy basepkg.SampleBase
+{
+ public class AnInnerClass {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4b.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4b.java
new file mode 100644
index 000000000..1d5728ae4
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4b.java
@@ -0,0 +1,8 @@
+package teampkg;
+
+/**
+ * $Id: Team_4b.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_4b
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4b/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4b/SampleRole.java
new file mode 100644
index 000000000..dfcdf870d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_4b/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_4b;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy basepkg.SampleBase
+{
+ public team class AnInnerTeamClass {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5a.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5a.java
new file mode 100644
index 000000000..78d4bca9b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5a.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_5a.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_5a
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5a/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5a/SampleRole.java
new file mode 100644
index 000000000..370deebb9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5a/SampleRole.java
@@ -0,0 +1,11 @@
+team package teampkg.Team_5a;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy basepkg.SampleBase
+{
+ public abstract void roleMethod();
+ roleMethod -> baseMethod;
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5b.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5b.java
new file mode 100644
index 000000000..59951f6da
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5b.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_5b.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_5b
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5b/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5b/SampleRole.java
new file mode 100644
index 000000000..0d6c895a4
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5b/SampleRole.java
@@ -0,0 +1,11 @@
+team package teampkg.Team_5b;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy basepkg.SampleBase
+{
+ public void roleMethod() {}
+ roleMethod => baseMethod;
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5c.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5c.java
new file mode 100644
index 000000000..c31cae0b8
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5c.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_5c.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_5c
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5c/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5c/SampleRole.java
new file mode 100644
index 000000000..21cf675e2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5c/SampleRole.java
@@ -0,0 +1,11 @@
+team package teampkg.Team_5c;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy basepkg.SampleBase
+{
+ public void roleMethod() {}
+ roleMethod <- before baseMethod;
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5d.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5d.java
new file mode 100644
index 000000000..aff286ebf
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5d.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_5d.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_5d
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5d/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5d/SampleRole.java
new file mode 100644
index 000000000..87669bd72
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5d/SampleRole.java
@@ -0,0 +1,11 @@
+team package teampkg.Team_5d;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy basepkg.SampleBase
+{
+ public callin void roleMethod() {}
+ roleMethod <- replace baseMethod;
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5e.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5e.java
new file mode 100644
index 000000000..399e40276
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5e.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_5e.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_5e
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5e/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5e/SampleRole.java
new file mode 100644
index 000000000..ab9633a0a
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoordinary/teampkg/Team_5e/SampleRole.java
@@ -0,0 +1,11 @@
+team package teampkg.Team_5e;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy basepkg.SampleBase
+{
+ public void roleMethod() {}
+ roleMethod <- after baseMethod;
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/TeamB.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/TeamB.java
new file mode 100644
index 000000000..8d824cba6
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/TeamB.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: TeamB.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamB
+{
+ public void baseMethod() {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_1.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_1.java
new file mode 100644
index 000000000..3aaab4aac
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_1.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_1.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_1
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_1/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_1/SampleRole.java
new file mode 100644
index 000000000..5b8892610
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_1/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_1;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy TeamB
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_2.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_2.java
new file mode 100644
index 000000000..4b3e03ac7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_2.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_2.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_2
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_2/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_2/SampleRole.java
new file mode 100644
index 000000000..01bb31d2d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_2/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_2;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 21820 2009-06-30 22:50:01Z stephan $
+ */
+public class SampleRole playedBy TeamB
+{
+ public String roleAttr = "AStringAttribut";
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3a.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3a.java
new file mode 100644
index 000000000..cffaab65d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3a.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_3a.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_3a
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3a/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3a/SampleRole.java
new file mode 100644
index 000000000..437f2e4cc
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3a/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_3a;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy TeamB
+{
+ public void roleMethod() {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3b.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3b.java
new file mode 100644
index 000000000..2fd7ad66f
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3b.java
@@ -0,0 +1,8 @@
+package teampkg;
+
+/**
+ * $Id: Team_3b.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_3b
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3b/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3b/SampleRole.java
new file mode 100644
index 000000000..d7c5c1760
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3b/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_3b;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy TeamB
+{
+ public void roleMethod(String paraObj) {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3c.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3c.java
new file mode 100644
index 000000000..844506c2a
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3c.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_3c.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_3c
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3c/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3c/SampleRole.java
new file mode 100644
index 000000000..895a93e26
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3c/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_3c;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy TeamB
+{
+ public String roleMethod() {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3d.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3d.java
new file mode 100644
index 000000000..d0fdfed29
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3d.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_3d.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_3d
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3d/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3d/SampleRole.java
new file mode 100644
index 000000000..8e50e5b1b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_3d/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_3d;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy TeamB
+{
+ public void roleMethod() throws Exception {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4a.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4a.java
new file mode 100644
index 000000000..b6243f881
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4a.java
@@ -0,0 +1,8 @@
+package teampkg;
+
+/**
+ * $Id: Team_4a.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_4a
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4a/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4a/SampleRole.java
new file mode 100644
index 000000000..84185f702
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4a/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_4a;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 6589 2005-08-11 17:52:37Z carp $
+ */
+public class SampleRole playedBy TeamB
+{
+ public class AnInnerClass {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4b.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4b.java
new file mode 100644
index 000000000..1d5728ae4
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4b.java
@@ -0,0 +1,8 @@
+package teampkg;
+
+/**
+ * $Id: Team_4b.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_4b
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4b/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4b/SampleRole.java
new file mode 100644
index 000000000..761b24dd2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_4b/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_4b;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy TeamB
+{
+ public team class AnInnerTeamClass {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5a.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5a.java
new file mode 100644
index 000000000..78d4bca9b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5a.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_5a.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_5a
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5a/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5a/SampleRole.java
new file mode 100644
index 000000000..237dacaa6
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5a/SampleRole.java
@@ -0,0 +1,11 @@
+team package teampkg.Team_5a;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy TeamB
+{
+ public abstract void roleMethod();
+ roleMethod -> baseMethod;
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5b.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5b.java
new file mode 100644
index 000000000..59951f6da
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5b.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_5b.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_5b
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5b/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5b/SampleRole.java
new file mode 100644
index 000000000..95b608a7d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5b/SampleRole.java
@@ -0,0 +1,11 @@
+team package teampkg.Team_5b;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy TeamB
+{
+ public void roleMethod() {}
+ roleMethod => baseMethod;
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5c.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5c.java
new file mode 100644
index 000000000..c31cae0b8
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5c.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_5c.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_5c
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5c/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5c/SampleRole.java
new file mode 100644
index 000000000..a02bc4bc4
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5c/SampleRole.java
@@ -0,0 +1,11 @@
+team package teampkg.Team_5c;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy TeamB
+{
+ public void roleMethod() {}
+ roleMethod <- before baseMethod;
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5d.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5d.java
new file mode 100644
index 000000000..aff286ebf
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5d.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_5d.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_5d
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5d/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5d/SampleRole.java
new file mode 100644
index 000000000..6982460e9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5d/SampleRole.java
@@ -0,0 +1,11 @@
+team package teampkg.Team_5d;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy TeamB
+{
+ public callin void roleMethod() {}
+ roleMethod <- replace baseMethod;
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5e.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5e.java
new file mode 100644
index 000000000..399e40276
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5e.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: Team_5e.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class Team_5e
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5e/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5e/SampleRole.java
new file mode 100644
index 000000000..befab8e77
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/boundtoteam/teampkg/Team_5e/SampleRole.java
@@ -0,0 +1,11 @@
+team package teampkg.Team_5e;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole playedBy TeamB
+{
+ public void roleMethod() {}
+ roleMethod <- after baseMethod;
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_1.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_1.java
new file mode 100644
index 000000000..f17fae222
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_1.java
@@ -0,0 +1,11 @@
+package teampkg;
+
+/**
+ * $Id: Team_1.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an external defined, unbound role class, empty
+ */
+public team class Team_1
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_1/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_1/SampleRole.java
new file mode 100644
index 000000000..f71091fd9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_1/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_1;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_2.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_2.java
new file mode 100644
index 000000000..d98e54f5d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_2.java
@@ -0,0 +1,11 @@
+package teampkg;
+
+/**
+ * $Id: Team_2.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an external defined role class with an attribut
+ */
+public team class Team_2
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_2/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_2/SampleRole.java
new file mode 100644
index 000000000..a05cb25d7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_2/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_2;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 21820 2009-06-30 22:50:01Z stephan $
+ */
+public class SampleRole
+{
+ public String roleAttr = "AStringAttribut";
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3a.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3a.java
new file mode 100644
index 000000000..efe0edad0
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3a.java
@@ -0,0 +1,12 @@
+package teampkg;
+
+/**
+ * $Id: Team_3a.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an external defined role class with a method
+ * the method has no parameters
+ */
+public team class Team_3a
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3a/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3a/SampleRole.java
new file mode 100644
index 000000000..5f80549da
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3a/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_3a;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole
+{
+ public void roleMethod() {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3b.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3b.java
new file mode 100644
index 000000000..8f2538d6b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3b.java
@@ -0,0 +1,12 @@
+package teampkg;
+
+/**
+ * $Id: Team_3b.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an external defined role class with a method
+ * the method has an input parameter
+ */
+public team class Team_3b
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3b/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3b/SampleRole.java
new file mode 100644
index 000000000..be42c18b4
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3b/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_3b;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole
+{
+ public void roleMethod(String paraObj) {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3c.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3c.java
new file mode 100644
index 000000000..413f4a52e
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3c.java
@@ -0,0 +1,12 @@
+package teampkg;
+
+/**
+ * $Id: Team_3c.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an external defined role class with a method
+ * the method has an output parameter
+ */
+public team class Team_3c
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3c/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3c/SampleRole.java
new file mode 100644
index 000000000..28ef763a0
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3c/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_3c;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole
+{
+ public String roleMethod() {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3d.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3d.java
new file mode 100644
index 000000000..b74fd61b5
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3d.java
@@ -0,0 +1,12 @@
+package teampkg;
+
+/**
+ * $Id: Team_3d.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase
+ * an external defined role class with a method
+ * the method has a throw-clause
+ */
+public team class Team_3d
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3d/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3d/SampleRole.java
new file mode 100644
index 000000000..495f47463
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_3d/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_3d;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole
+{
+ public void roleMethod() throws Exception {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4a.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4a.java
new file mode 100644
index 000000000..5a2d05767
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4a.java
@@ -0,0 +1,12 @@
+package teampkg;
+
+/**
+ * $Id: Team_4a.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an external defined role class with an innerclass
+ * the innerclass is an ordinary class
+ */
+public team class Team_4a
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4a/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4a/SampleRole.java
new file mode 100644
index 000000000..e1ab78a69
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4a/SampleRole.java
@@ -0,0 +1,10 @@
+team package teampkg.Team_4a;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 6589 2005-08-11 17:52:37Z carp $
+ */
+public class SampleRole
+{
+ public class AnInnerClass {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4b.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4b.java
new file mode 100644
index 000000000..f100b52c4
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4b.java
@@ -0,0 +1,12 @@
+package teampkg;
+
+/**
+ * $Id: Team_4b.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an external defined role class with an innerclass
+ * the innerclass is a team class
+ */
+public team class Team_4b
+{
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4b/SampleRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4b/SampleRole.java
new file mode 100644
index 000000000..e7e2839ee
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/ExternalDefinedRole/unbound/teampkg/Team_4b/SampleRole.java
@@ -0,0 +1,10 @@
+package teampkg.Team_4b;
+
+/**
+ * @author kaschja
+ * @version $Id: SampleRole.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleRole
+{
+ public team class AnInnerTeamClass {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/.classpath b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/.classpath
new file mode 100644
index 000000000..1a916c9e9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/.classpath
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="unbound"/>
+ <classpathentry kind="src" path="boundtoordinary"/>
+ <classpathentry kind="src" path="boundtoteam"/>
+ <classpathentry kind="src" path="ordinaryclasses"/>
+ <classpathentry kind="var" path="JCL_LIB" sourcepath="JCL_SRC" rootpath="JCL_SRCROOT"/>
+ <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="lib" sourcepath="src" path="bins"/>
+
+ <classpathentry kind="var" path="OTDT_INSTALLDIR/lib/otre.jar"/>
+</classpath>
+
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/.project b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/.project
new file mode 100644
index 000000000..cd779f8c0
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/.project
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>InternalDefinedRole</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.objectteams.otdt.builder.OTJBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.objectteams.otdt.OTJavaNature</nature>
+ </natures>
+</projectDescription>
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/basepkg/SampleBase.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/basepkg/SampleBase.java
new file mode 100644
index 000000000..dc8ce1008
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/basepkg/SampleBase.java
@@ -0,0 +1,9 @@
+package basepkg;
+
+/**
+ * $Id: SampleBase.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class SampleBase
+{
+ public void baseMethod() {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_1.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_1.java
new file mode 100644
index 000000000..95f12de09
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_1.java
@@ -0,0 +1,13 @@
+package teampkg;
+
+/**
+ * $Id: Team_1.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an internal defined bound role class, empty
+ * the base class of the role is an ordinary class
+ */
+public team class Team_1
+{
+ public class SampleRole playedBy basepkg.SampleBase {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_2.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_2.java
new file mode 100644
index 000000000..a376292ff
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_2.java
@@ -0,0 +1,16 @@
+package teampkg;
+
+/**
+ * $Id: Team_2.java 21820 2009-06-30 22:50:01Z stephan $
+ *
+ * testcase:
+ * an internal defined bound role class with an attribut
+ * the base class of the role is an ordinary class
+ */
+public team class Team_2
+{
+ public class SampleRole playedBy basepkg.SampleBase
+ {
+ public String roleAttr = "AStringAttribut";
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3a.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3a.java
new file mode 100644
index 000000000..4834c1f15
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3a.java
@@ -0,0 +1,17 @@
+package teampkg;
+
+/**
+ * $Id: Team_3a.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an internal defined bound role class with a method
+ * the method has no parameters
+ * the base class of the role is an ordinary class
+ */
+public team class Team_3a
+{
+ public class SampleRole playedBy basepkg.SampleBase
+ {
+ public void roleMethod() {}
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3b.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3b.java
new file mode 100644
index 000000000..fb5f0c38c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3b.java
@@ -0,0 +1,17 @@
+package teampkg;
+
+/**
+ * $Id: Team_3b.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an internal defined bound role class with a method
+ * the method has an input parameter
+ * the base class of the role is an ordinary class
+ */
+public team class Team_3b
+{
+ public class SampleRole playedBy basepkg.SampleBase
+ {
+ public void roleMethod(String paraObj) {}
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3c.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3c.java
new file mode 100644
index 000000000..c4f7ea9bc
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3c.java
@@ -0,0 +1,17 @@
+package teampkg;
+
+/**
+ * $Id: Team_3c.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an internal defined bound role class with a method
+ * the method has an output parameter
+ * the base class of the role is an ordinary class
+ */
+public team class Team_3c
+{
+ public class SampleRole playedBy basepkg.SampleBase
+ {
+ public String roleMethod() {}
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3d.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3d.java
new file mode 100644
index 000000000..6adcd2d9d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_3d.java
@@ -0,0 +1,17 @@
+package teampkg;
+
+/**
+ * $Id: Team_3d.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase
+ * an internal defined bound role class with a method
+ * the method has a throw-clause
+ * the base class of the role is an ordinary class
+ */
+public team class Team_3d
+{
+ public class SampleRole playedBy basepkg.SampleBase
+ {
+ public void roleMethod() throws Exception {}
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_4a.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_4a.java
new file mode 100644
index 000000000..0a30f7f53
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_4a.java
@@ -0,0 +1,17 @@
+package teampkg;
+
+/**
+ * $Id: Team_4a.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an internal defined bound role class with an innerclass
+ * the innerclass is an ordinary class
+ * the base class of the role is an ordinary class
+ */
+public team class Team_4a
+{
+ public team class SampleRole playedBy basepkg.SampleBase
+ {
+ public class AnInnerClass {}
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_4b.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_4b.java
new file mode 100644
index 000000000..82e7a0007
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_4b.java
@@ -0,0 +1,17 @@
+package teampkg;
+
+/**
+ * $Id: Team_4b.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an internal defined bound role class with an innerclass
+ * the innerclass is a team class
+ * the base class of the role is an ordinary class
+ */
+public team class Team_4b
+{
+ public team class SampleRole playedBy basepkg.SampleBase
+ {
+ public team class AnInnerTeamClass {}
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5a.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5a.java
new file mode 100644
index 000000000..fd50e115c
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5a.java
@@ -0,0 +1,19 @@
+package teampkg;
+
+/**
+ * $Id: Team_5a.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase
+ * a bound role class with a method and a method mapping
+ * the method is abstract and has no parameters
+ * the method mapping is a callout mapping (->)
+ * the base class of the role is an ordinary class
+ */
+public team class Team_5a
+{
+ public class SampleRole playedBy basepkg.SampleBase
+ {
+ public abstract void roleMethod();
+ roleMethod -> baseMethod;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5b.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5b.java
new file mode 100644
index 000000000..4fe7f7a0e
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5b.java
@@ -0,0 +1,19 @@
+package teampkg;
+
+/**
+ * $Id: Team_5b.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase
+ * a bound role class with a method and a method mapping
+ * the method is abstract and has no parameters
+ * the method mapping is a callout mapping (=>)
+ * the base class of the role is an ordinary class
+ */
+public team class Team_5b
+{
+ public class SampleRole playedBy basepkg.SampleBase
+ {
+ public void roleMethod() {}
+ roleMethod => baseMethod;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5c.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5c.java
new file mode 100644
index 000000000..4820f37cd
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5c.java
@@ -0,0 +1,19 @@
+package teampkg;
+
+/**
+ * $Id: Team_5c.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * a bound role class with a method and a method mapping
+ * the method is concrete and has no parameters
+ * the method mapping is a before-callin mapping
+ * the base class of the role is an ordinary class
+ */
+public team class Team_5c
+{
+ public class SampleRole playedBy basepkg.SampleBase
+ {
+ public void roleMethod() {}
+ roleMethod <- before baseMethod;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5d.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5d.java
new file mode 100644
index 000000000..950e9e87b
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5d.java
@@ -0,0 +1,19 @@
+package teampkg;
+
+/**
+ * $Id: Team_5d.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * a bound role class with a method and a method mapping
+ * the method is concrete, has no parameters but a callin modifier
+ * the method mapping is a replace-callin mapping
+ * the base class of the role is an ordinary class
+ */
+public team class Team_5d
+{
+ public class SampleRole playedBy basepkg.SampleBase
+ {
+ public callin void roleMethod() {}
+ roleMethod <- replace baseMethod;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5e.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5e.java
new file mode 100644
index 000000000..9ae8d7d7e
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoordinary/teampkg/Team_5e.java
@@ -0,0 +1,19 @@
+package teampkg;
+
+/**
+ * $Id: Team_5e.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * a bound role class with a method and a method mapping
+ * the method is concrete and has no parameters
+ * the method mapping is an after-callin mapping
+ * the base class of the role is an ordinary class
+ */
+public team class Team_5e
+{
+ public class SampleRole playedBy basepkg.SampleBase
+ {
+ public void roleMethod() {}
+ roleMethod <- after baseMethod;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/TeamB.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/TeamB.java
new file mode 100644
index 000000000..8d824cba6
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/TeamB.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: TeamB.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamB
+{
+ public void baseMethod() {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/TeamC.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/TeamC.java
new file mode 100644
index 000000000..b6a2eaa95
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/TeamC.java
@@ -0,0 +1,9 @@
+package teampkg;
+
+/**
+ * $Id: TeamC.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public team class TeamC
+{
+ public void baseMethod() {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_1.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_1.java
new file mode 100644
index 000000000..bbc77cf11
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_1.java
@@ -0,0 +1,13 @@
+package teampkg;
+
+/**
+ * $Id: Team_1.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an internal defined bound role class, empty
+ * the base class of the role is a team
+ */
+public team class Team_1
+{
+ public class SampleRole playedBy TeamB {}
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_2.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_2.java
new file mode 100644
index 000000000..6122c7115
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_2.java
@@ -0,0 +1,16 @@
+package teampkg;
+
+/**
+ * $Id: Team_2.java 21820 2009-06-30 22:50:01Z stephan $
+ *
+ * testcase:
+ * an internal defined bound role class with an attribut
+ * the base class of the role is a team
+ */
+public team class Team_2
+{
+ public class SampleRole playedBy TeamB
+ {
+ public String roleAttr = "AStringAttribut";
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3a.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3a.java
new file mode 100644
index 000000000..1f4258efd
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3a.java
@@ -0,0 +1,17 @@
+package teampkg;
+
+/**
+ * $Id: Team_3a.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an internal defined bound role class with a method
+ * the method has no parameters
+ * the base class of the role is a team
+ */
+public team class Team_3a
+{
+ public class SampleRole playedBy TeamB
+ {
+ public void roleMethod() {}
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3b.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3b.java
new file mode 100644
index 000000000..4af2fc7e5
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3b.java
@@ -0,0 +1,17 @@
+package teampkg;
+
+/**
+ * $Id: Team_3b.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an internal defined bound role class with a method
+ * the method has an input parameter
+ * the base class of the role is a team
+ */
+public team class Team_3b
+{
+ public class SampleRole playedBy TeamB
+ {
+ public void roleMethod(String paraObj) {}
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3c.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3c.java
new file mode 100644
index 000000000..19d6d56f6
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3c.java
@@ -0,0 +1,17 @@
+package teampkg;
+
+/**
+ * $Id: Team_3c.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an internal defined bound role class with a method
+ * the method has an output parameter
+ * the base class of the role is a team
+ */
+public team class Team_3c
+{
+ public class SampleRole playedBy TeamB
+ {
+ public String roleMethod() {}
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3d.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3d.java
new file mode 100644
index 000000000..b9c2dfb73
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_3d.java
@@ -0,0 +1,17 @@
+package teampkg;
+
+/**
+ * $Id: Team_3d.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase
+ * an internal defined bound role class with a method
+ * the method has a throw-clause
+ * the base class of the role is a team
+ */
+public team class Team_3d
+{
+ public class SampleRole playedBy TeamB
+ {
+ public void roleMethod() throws Exception {}
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_4a.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_4a.java
new file mode 100644
index 000000000..d55f0f4f2
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_4a.java
@@ -0,0 +1,17 @@
+package teampkg;
+
+/**
+ * $Id: Team_4a.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an internal defined bound role class with an innerclass
+ * the innerclass is an ordinary class
+ * the base class of the role is a team
+ */
+public team class Team_4a
+{
+ public team class SampleRole playedBy TeamB
+ {
+ public class AnInnerClass {}
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_4b.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_4b.java
new file mode 100644
index 000000000..50ef902cf
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_4b.java
@@ -0,0 +1,17 @@
+package teampkg;
+
+/**
+ * $Id: Team_4b.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * an internal defined bound role class with an innerclass
+ * the innerclass is a team class
+ * the base class of the role is a team
+ */
+public team class Team_4b
+{
+ public team class SampleRole playedBy TeamB
+ {
+ public team class AnInnerTeamClass {}
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5a.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5a.java
new file mode 100644
index 000000000..14e560bc7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5a.java
@@ -0,0 +1,19 @@
+package teampkg;
+
+/**
+ * $Id: Team_5a.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase
+ * a bound role class with a method and a method mapping
+ * the method is abstract and has no parameters
+ * the method mapping is a callout mapping (->)
+ * the base class of the role is a team
+ */
+public team class Team_5a
+{
+ public class SampleRole playedBy TeamC
+ {
+ public abstract void roleMethod();
+ roleMethod -> baseMethod;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5b.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5b.java
new file mode 100644
index 000000000..c47afc630
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5b.java
@@ -0,0 +1,19 @@
+package teampkg;
+
+/**
+ * $Id: Team_5b.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase
+ * a bound role class with a method and a method mapping
+ * the method is abstract and has no parameters
+ * the method mapping is a callout mapping (=>)
+ * the base class of the role is a team
+ */
+public team class Team_5b
+{
+ public class SampleRole playedBy TeamC
+ {
+ public void roleMethod() {}
+ roleMethod => baseMethod;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5c.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5c.java
new file mode 100644
index 000000000..fac2a892d
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5c.java
@@ -0,0 +1,19 @@
+package teampkg;
+
+/**
+ * $Id: Team_5c.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * a bound role class with a method and a method mapping
+ * the method is concrete and has no parameters
+ * the method mapping is a before-callin mapping
+ * the base class of the role is a team
+ */
+public team class Team_5c
+{
+ public class SampleRole playedBy TeamC
+ {
+ public void roleMethod() {}
+ roleMethod <- before baseMethod;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5d.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5d.java
new file mode 100644
index 000000000..d87eff0f9
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5d.java
@@ -0,0 +1,19 @@
+package teampkg;
+
+/**
+ * $Id: Team_5d.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * a bound role class with a method and a method mapping
+ * the method is concrete, has no parameters but a callin modifier
+ * the method mapping is a replace-callin mapping
+ * the base class of the role is a team
+ */
+public team class Team_5d
+{
+ public class SampleRole playedBy TeamC
+ {
+ public callin void roleMethod() {}
+ roleMethod <- replace baseMethod;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5e.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5e.java
new file mode 100644
index 000000000..e83cfe065
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/boundtoteam/teampkg/Team_5e.java
@@ -0,0 +1,19 @@
+package teampkg;
+
+/**
+ * $Id: Team_5e.java 5749 2005-05-30 11:52:29Z anklam $
+ *
+ * testcase:
+ * a bound role class with a method and a method mapping
+ * the method is concrete and has no parameters
+ * the method mapping is an after-callin mapping
+ * the base class of the role is a team
+ */
+public team class Team_5e
+{
+ public class SampleRole playedBy TeamC
+ {
+ public void roleMethod() {}
+ roleMethod <- after baseMethod;
+ }
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/ordinaryclasses/ordinaryclasses/EmptyClass.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/ordinaryclasses/ordinaryclasses/EmptyClass.java
new file mode 100644
index 000000000..17add34f7
--- /dev/null
+++ b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/ordinaryclasses/ordinaryclasses/EmptyClass.java
@@ -0,0 +1,10 @@
+package ordinaryclasses;
+
+/**
+ * @author kaschja
+ * @version $Id: EmptyClass.java 5749 2005-05-30 11:52:29Z anklam $
+ */
+public class EmptyClass
+{
+
+}
diff --git a/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/unbound/teampkg/TeamWithRoleWithImplicitSuperRole.java b/testplugins/org.eclipse.objectteams.otdt.ui.tests/workspace/InternalDefinedRole/unbound/teampkg/TeamWithRoleWithImplicitSuperRole.java
new file mode 100644
index 000000000..5fc99b155
--- /dev/null
+++ b/