aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Gottschaemmer2013-01-24 11:17:15 (EST)
committerPatrick Gottschaemmer2013-01-24 11:53:24 (EST)
commit570f661dc3b1ef822180e7aa7311e52e5415355a (patch)
tree912ae28795edbd111f34bb55130a11ceffe09ac0
parent38520252f3bd6aebf7f19c612f573cf46ce31403 (diff)
downloadorg.eclipse.recommenders-570f661dc3b1ef822180e7aa7311e52e5415355a.zip
org.eclipse.recommenders-570f661dc3b1ef822180e7aa7311e52e5415355a.tar.gz
org.eclipse.recommenders-570f661dc3b1ef822180e7aa7311e52e5415355a.tar.bz2
[misc] normalization to Unix line delimitersrefs/changes/85/9885/4
All line delimiters of text files are now normalized to Unix format. Additionally, all text files now end with a new line. Change-Id: I044af8aa8fac1504aefdb28baf369aba9253b87f
-rw-r--r--dist/org.eclipse.recommenders.repository.rcp.dev.e37/index.php170
-rw-r--r--dist/org.eclipse.recommenders.repository.rcp.dev.e37/pom.xml22
-rw-r--r--dist/org.eclipse.recommenders.repository.rcp.dev.e42/index.php170
-rw-r--r--dist/org.eclipse.recommenders.repository.rcp.dev.e42/pom.xml22
-rw-r--r--dist/org.eclipse.recommenders.repository.rcp.head.e37/index.php170
-rw-r--r--dist/org.eclipse.recommenders.repository.rcp.head.e37/pom.xml22
-rw-r--r--dist/org.eclipse.recommenders.repository.rcp.head.e42/index.php170
-rw-r--r--dist/org.eclipse.recommenders.repository.rcp.head.e42/pom.xml22
-rw-r--r--dist/org.eclipse.recommenders.repository.rcp.train.e42/index.php170
-rw-r--r--dist/org.eclipse.recommenders.repository.rcp.train.e42/pom.xml226
-rw-r--r--dist/org.eclipse.recommenders.repository.rcp.train.e43/index.php170
-rw-r--r--dist/org.eclipse.recommenders.repository.rcp.train.e43/pom.xml210
-rw-r--r--dist/org.eclipse.recommenders.repository.rcp/index.php170
-rw-r--r--dist/org.eclipse.recommenders.repository.rcp/pom.xml48
-rw-r--r--etc/eclipse/Checkstyle.xml10
-rw-r--r--etc/licenses/pom.xml22
-rw-r--r--etc/licenses/src/main/resources/license-chengchen-2012.txt12
-rw-r--r--etc/licenses/src/main/resources/license-doug-ye-2011.txt8
-rw-r--r--etc/licenses/src/main/resources/license-doug-ye-cheng.txt12
-rw-r--r--etc/licenses/src/main/resources/license-frankenberger-2011.txt12
-rw-r--r--etc/scripts/index.php170
-rw-r--r--features/org.eclipse.recommenders.feature.3rd.orbit/pom.xml38
-rw-r--r--features/org.eclipse.recommenders.feature.3rd.rcp.nonjuno/pom.xml38
-rw-r--r--features/org.eclipse.recommenders.feature.3rd.rcp.nonorbit/pom.xml38
-rw-r--r--features/org.eclipse.recommenders.feature.completion.rcp.chain.e37/build.properties32
-rw-r--r--features/org.eclipse.recommenders.feature.completion.rcp.chain.e37/pom.xml38
-rw-r--r--features/org.eclipse.recommenders.feature.completion.rcp.chain/build.properties32
-rw-r--r--features/org.eclipse.recommenders.feature.completion.rcp.chain/pom.xml38
-rw-r--r--features/org.eclipse.recommenders.feature.completion.rcp.intellig.e37/build.properties32
-rw-r--r--features/org.eclipse.recommenders.feature.completion.rcp.intellig.e37/pom.xml38
-rw-r--r--features/org.eclipse.recommenders.feature.completion.rcp.intellig/build.properties32
-rw-r--r--features/org.eclipse.recommenders.feature.completion.rcp.intellig/pom.xml38
-rw-r--r--features/org.eclipse.recommenders.feature.completion.rcp.sandbox/build.properties32
-rw-r--r--features/org.eclipse.recommenders.feature.completion.rcp.sandbox/pom.xml38
-rw-r--r--features/org.eclipse.recommenders.feature.completion.rcp.subwords/build.properties32
-rw-r--r--features/org.eclipse.recommenders.feature.completion.rcp.subwords/pom.xml38
-rw-r--r--features/org.eclipse.recommenders.feature.extdoc.rcp/build.properties32
-rw-r--r--features/org.eclipse.recommenders.feature.extdoc.rcp/pom.xml38
-rw-r--r--features/org.eclipse.recommenders.feature.license/pom.xml24
-rw-r--r--features/org.eclipse.recommenders.feature.rcp.core/build.properties32
-rw-r--r--features/org.eclipse.recommenders.feature.rcp.core/pom.xml38
-rw-r--r--features/org.eclipse.recommenders.feature.rcp/build.properties32
-rw-r--r--features/org.eclipse.recommenders.feature.rcp/pom.xml38
-rw-r--r--features/org.eclipse.recommenders.feature.rdk/pom.xml40
-rw-r--r--features/org.eclipse.recommenders.feature.snipmatch.rcp/.project34
-rw-r--r--features/org.eclipse.recommenders.feature.snipmatch.rcp/build.properties34
-rw-r--r--features/org.eclipse.recommenders.feature.snipmatch.rcp/pom.xml38
-rw-r--r--features/org.eclipse.recommenders.feature.tests/pom.xml42
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/plugin.xml106
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/pom.xml38
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/AstBasedObjectUsageResolver.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsCompletionProposalComputer.java700
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsRecommendation.java108
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsSessionProcessor.java552
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/net/BayesNetWrapper.java784
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/net/IObjectMethodCallsNet.java134
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/CallPreferencePage.java710
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/ModelLabelProvider.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/PackageFragmentRootLabelProvider.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/VersionLabelProvider.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/CallsCompletionModule.java126
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/CallsCompletionPlugin.java108
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/ManualModelStoreWiring.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/pom.xml40
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferencePage.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.e37/pom.xml38
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/CompilerAstCompletionNodeFinder.java2214
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/E37GuiceModule.java52
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/IntelligentCompletionProposalCollector.java82
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.e38/pom.xml38
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.e38/src/org/eclipse/recommenders/internal/completion/rcp/E38GuiceModule.java52
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.overrides/plugin.xml60
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.overrides/pom.xml42
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ClassOverridesNetwork.java240
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ClassOverridesNetworkBuilder.java292
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ManualModelStoreWiring.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesCompletionProposalComputer.java236
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesModule.java118
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesRecommendation.java74
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesRecommender.java244
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesSessionProcessor.java140
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesZipModelFactory.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.sandbox/plugin.xml64
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.sandbox/pom.xml38
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.sandbox/src/org/eclipse/recommenders/internal/completion/rcp/sandbox/TypeProposalsProcessor.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.sandbox/src/org/eclipse/recommenders/internal/completion/rcp/sandbox/TypoSessionProcessor.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/plugin.xml74
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/pom.xml38
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/PreferencePage.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsCompletionProposalComputer.java260
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsCompletionRequestor.java436
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsProposalContext.java202
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsUtils.java132
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/proposals/ProposalFactory.java354
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/proposals/SwAnonymousTypeCompletionProposal.java126
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/proposals/SwJavaCompletionProposal.java92
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/proposals/SwJavaFieldWithCastedReceiverCompletionProposal.java92
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/proposals/SwJavaMethodCompletionProposal.java86
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/proposals/SwLazyGenericTypeProposal.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/proposals/SwLazyJavaTypeCompletionProposal.java102
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/proposals/SwOverrideCompletionProposal.java90
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.templates/.classpath16
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.templates/plugin.xml56
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp.templates/src/org/eclipse/recommenders/internal/completion/rcp/templates/TemplatesCompletionProposalComputer.java890
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/plugin.xml38
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/pom.xml38
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/completion/rcp/ProposalProcessor.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/internal/completion/rcp/GuiceModule.java58
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/internal/completion/rcp/ProcessableCompletionProposalComputer.java396
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/internal/completion/rcp/ProposalCollectingCompletionRequestor.java392
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/internal/completion/rcp/SimpleProposalProcessor.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/internal/completion/rcp/proposals/ProcessableAnonymousTypeCompletionProposal.java188
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/internal/completion/rcp/proposals/ProcessableJavaCompletionProposal.java128
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/internal/completion/rcp/proposals/ProcessableJavaFieldWithCastedReceiverCompletionProposal.java136
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/internal/completion/rcp/proposals/ProcessableJavaMethodCompletionProposal.java128
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/internal/completion/rcp/proposals/ProcessableLazyGenericTypeProposal.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/internal/completion/rcp/proposals/ProcessableLazyJavaTypeCompletionProposal.java124
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/internal/completion/rcp/proposals/ProcessableMethodDeclarationCompletionProposal.java2
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/internal/completion/rcp/proposals/ProcessableOverrideCompletionProposal.java158
-rw-r--r--plugins/org.eclipse.recommenders.completion.rcp/src/org/eclipse/recommenders/internal/completion/rcp/proposals/ProcessableProposalFactory.java406
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/.classpath14
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/plugin.xml136
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/pom.xml38
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/src/org/eclipse/recommenders/extdoc/rcp/providers/ExtdocProvider.java2
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/src/org/eclipse/recommenders/extdoc/rcp/providers/ExtdocProviderDescription.java2
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/src/org/eclipse/recommenders/extdoc/rcp/providers/JavaSelectionSubscriber.java2
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/src/org/eclipse/recommenders/internal/extdoc/rcp/providers/JavadocProvider.java450
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/src/org/eclipse/recommenders/internal/extdoc/rcp/ui/ExtdocPreferences.java2
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/src/org/eclipse/recommenders/internal/extdoc/rcp/ui/ExtdocProviderTransfer.java2
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/src/org/eclipse/recommenders/internal/extdoc/rcp/ui/ExtdocUtils.java790
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/src/org/eclipse/recommenders/internal/extdoc/rcp/ui/ExtdocView.java2
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/src/org/eclipse/recommenders/internal/extdoc/rcp/ui/ProviderArea.java2
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/src/org/eclipse/recommenders/internal/extdoc/rcp/ui/SourceCodeArea.java180
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/src/org/eclipse/recommenders/internal/extdoc/rcp/ui/SubscriptionManager.java2
-rw-r--r--plugins/org.eclipse.recommenders.extdoc.rcp/src/org/eclipse/recommenders/internal/extdoc/rcp/wiring/ExtdocModule.java2
-rw-r--r--plugins/org.eclipse.recommenders.extdoc/pom.xml38
-rw-r--r--plugins/org.eclipse.recommenders.extdoc/src/org/eclipse/recommenders/extdoc/ClassOverrideDirectives.java126
-rw-r--r--plugins/org.eclipse.recommenders.extdoc/src/org/eclipse/recommenders/extdoc/ClassOverridePatterns.java112
-rw-r--r--plugins/org.eclipse.recommenders.extdoc/src/org/eclipse/recommenders/extdoc/ClassSelfcallDirectives.java126
-rw-r--r--plugins/org.eclipse.recommenders.extdoc/src/org/eclipse/recommenders/extdoc/CodeExamples.java104
-rw-r--r--plugins/org.eclipse.recommenders.extdoc/src/org/eclipse/recommenders/extdoc/CodeSnippet.java2
-rw-r--r--plugins/org.eclipse.recommenders.extdoc/src/org/eclipse/recommenders/extdoc/IExtdocResource.java2
-rw-r--r--plugins/org.eclipse.recommenders.extdoc/src/org/eclipse/recommenders/extdoc/MethodPattern.java124
-rw-r--r--plugins/org.eclipse.recommenders.extdoc/src/org/eclipse/recommenders/extdoc/MethodSelfcallDirectives.java126
-rw-r--r--plugins/org.eclipse.recommenders.injection/pom.xml38
-rw-r--r--plugins/org.eclipse.recommenders.injection/src/org/eclipse/recommenders/internal/injection/InjectionDescriptor.java138
-rw-r--r--plugins/org.eclipse.recommenders.jayes.serialization/.classpath14
-rw-r--r--plugins/org.eclipse.recommenders.jayes.serialization/.settings/org.eclipse.jdt.core.prefs16
-rw-r--r--plugins/org.eclipse.recommenders.jayes.serialization/build.properties12
-rw-r--r--plugins/org.eclipse.recommenders.jayes.serialization/pom.xml38
-rw-r--r--plugins/org.eclipse.recommenders.jayes.serialization/src/org/eclipse/recommenders/commons/bayesnet/BayesianNetwork.java186
-rw-r--r--plugins/org.eclipse.recommenders.jayes.serialization/src/org/eclipse/recommenders/commons/bayesnet/Node.java236
-rw-r--r--plugins/org.eclipse.recommenders.jayes/src/org/eclipse/recommenders/jayes/inference/AbstractInferer.java128
-rw-r--r--plugins/org.eclipse.recommenders.jayes/src/org/eclipse/recommenders/jayes/inference/junctionTree/JunctionTree.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/.classpath14
-rw-r--r--plugins/org.eclipse.recommenders.rcp/.settings/org.eclipse.jdt.core.prefs16
-rw-r--r--plugins/org.eclipse.recommenders.rcp/build.properties44
-rw-r--r--plugins/org.eclipse.recommenders.rcp/plugin.xml100
-rw-r--r--plugins/org.eclipse.recommenders.rcp/pom.xml38
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/IModelArchive.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/IModelArchiveStore.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/IModelFactory.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/NullModelArchive.java104
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/archive/PoolingModelArchive.java244
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/store/IDependenciesFactory.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/models/store/ModelArchiveResolutionJob.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/providers/JavaModelEventsProvider.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ModelRepositoryIndex.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/ServiceBasedProxySelector.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/repo/TransferListener.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/internal/rcp/ui/ModelsPreferencePage.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/ClasspathEntryInfo.java222
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/IClasspathEntryInfoProvider.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/IRecommendation.java36
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/RecommendersPlugin.java118
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/events/JavaSelectionEvent.java248
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/repo/IModelRepository.java2
-rw-r--r--plugins/org.eclipse.recommenders.rcp/src/org/eclipse/recommenders/rcp/repo/IModelRepositoryIndex.java2
-rw-r--r--plugins/org.eclipse.recommenders.rdk/pom.xml40
-rw-r--r--plugins/org.eclipse.recommenders.rdk/src/org/eclipse/recommenders/rdk/index/ModelDocuments.java90
-rw-r--r--plugins/org.eclipse.recommenders.rdk/src/org/eclipse/recommenders/rdk/index/ModelDocumentsWriter.java488
-rw-r--r--plugins/org.eclipse.recommenders.rdk/src/org/eclipse/recommenders/rdk/utils/ConsoleProgressMonitor.java2
-rw-r--r--plugins/org.eclipse.recommenders.rdk/src/org/eclipse/recommenders/rdk/utils/Settings.java2
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/.classpath14
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/.project56
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/build.properties16
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/plugin.xml424
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/pom.xml38
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/ArgumentMatchNode.java108
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/Effect.java646
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/EffectMatchNode.java310
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/EffectParameter.java140
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/FormulaSnippetNode.java136
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/ISnippetNode.java38
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/MatchEnvironment.java346
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/MatchNode.java104
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/MatchType.java30
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/SnippetMatchEnvironment.java348
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/SnippetParser.java280
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/SummaryFileMap.java64
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/TemplateVariableElement.java96
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/TextSnippetNode.java72
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/local/Constants.java36
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/local/CreateIndexOperation.java146
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/local/LocalMatchClient.java338
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/local/LocalSearchThread.java214
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/local/PatternRankSearchEngine.java692
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/local/StringCompareSearchEngine.java316
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/preferences/GitRepositorySettingPreferencePage.java184
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/preferences/PreferenceConstants.java62
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/preferences/PreferenceInitializer.java98
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/preferences/SnipMatchPreferencePage.java108
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/CheckUpdateThread.java162
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/CloseOnIgnoreListener.java162
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/CommandHandler.java104
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/CompleteMatchThread.java124
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/ICompleteMatchListener.java34
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/JavaSnippetMatchEnvironment.java3000
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/LoginBox.java500
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/ProfileBox.java722
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/SearchBox.java1284
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/SignInStatusTester.java48
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/SnipMatchPlugin.java722
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/SubmitBox.java2750
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/ClientSwitcher.java40
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/SearchClient.java128
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/search/SnipMatchSearchEngine.java62
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/view/SnippetsView.java544
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/view/ViewConstants.java38
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/DeleteEffectThread.java206
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/IDeleteEffectListener.java30
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/ILoadProfileListener.java36
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/ILoginListener.java30
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/ISearchListener.java36
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/ISendFeedbackListener.java30
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/ISubmitEffectListener.java30
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/LoadProfileThread.java258
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/LoginThread.java222
-rwxr-xr-xplugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/MatchConverter.java344
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/PostThread.java152
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/RemoteMatchClient.java478
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/SearchThread.java528
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/SendFeedbackThread.java400
-rw-r--r--plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/web/SubmitEffectThread.java302
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/.classpath14
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/.settings/org.eclipse.jdt.core.prefs16
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/build.properties36
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/pom.xml40
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/CompilerBindings.java348
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/CompletionProposalDecorator.java336
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/JavaElementResolver.java750
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/JdtCompletionProposal.java2
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/JdtUtils.java1240
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/LoggingUtils.java254
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/RCPUtils.java176
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/UUIDHelper.java180
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/ast/ASTNodeUtils.java462
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/ast/ASTStringUtils.java356
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/ast/BindingUtils.java558
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/ast/MethodDeclarationFinder.java156
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/internal/MyWorkingCopyOwner.java50
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/internal/PreferencesInitalizer.java52
-rw-r--r--plugins/org.eclipse.recommenders.utils.rcp/src/org/eclipse/recommenders/utils/rcp/internal/RecommendersUtilsPlugin.java116
-rw-r--r--plugins/org.eclipse.recommenders.utils/pom.xml40
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/internal/utils/codestructs/MethodDeclaration.java114
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/internal/utils/codestructs/ObjectInstanceKey.java98
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/internal/utils/codestructs/ObjectUsage.java228
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/Bag.java224
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/BidirectionalHashMap.java108
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/Checks.java480
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/FixedSizeLinkedHashMap.java2
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/GenericEnumerationUtils.java84
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/HashBag.java478
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/Throws.java164
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/TreeBag.java112
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/Version.java186
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/VersionRange.java500
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/archive/ArchiveDetailsExtractor.java290
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/archive/ArchiveMetaData.java58
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/archive/ClassId.java38
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/archive/ClassIdExtractor.java108
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/archive/FilenameJarIdExtractor.java62
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/archive/IExtractor.java38
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/archive/JarIdExtractor.java82
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/archive/MavenPomJarIdExtractor.java134
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/archive/OsgiManifestJarIdExtractor.java104
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/gson/GsonFieldNameDeserializer.java60
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/gson/GsonFileDeserializer.java58
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/gson/GsonMethodNameDeserializer.java62
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/gson/GsonNameSerializer.java54
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/gson/GsonTypeNameDeserializer.java62
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/gson/GsonUtil.java380
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/gson/MultimapTypeAdapter.java122
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/gson/ParameterizedTypeImpl.java86
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/names/VmTypeName.java452
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/parser/IVersionParser.java42
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/parser/MavenVersionParser.java162
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/parser/OsgiVersionParser.java150
-rw-r--r--plugins/org.eclipse.recommenders.utils/src/org/eclipse/recommenders/utils/parser/VersionParserFactory.java80
-rw-r--r--plugins/org.eclipse.recommenders.webclient/pom.xml40
-rw-r--r--plugins/org.eclipse.recommenders.webclient/src/org/eclipse/recommenders/webclient/ClientConfiguration.java94
-rw-r--r--plugins/org.eclipse.recommenders.webclient/src/org/eclipse/recommenders/webclient/CouchUtils.java148
-rw-r--r--plugins/org.eclipse.recommenders.webclient/src/org/eclipse/recommenders/webclient/WebServiceClient.java462
-rw-r--r--plugins/org.eclipse.recommenders.webclient/src/org/eclipse/recommenders/webclient/exceptions/ConflictException.java42
-rw-r--r--plugins/org.eclipse.recommenders.webclient/src/org/eclipse/recommenders/webclient/exceptions/InvalidRequestException.java38
-rw-r--r--plugins/org.eclipse.recommenders.webclient/src/org/eclipse/recommenders/webclient/exceptions/NotFoundException.java40
-rw-r--r--plugins/org.eclipse.recommenders.webclient/src/org/eclipse/recommenders/webclient/exceptions/ServerCommunicationException.java48
-rw-r--r--plugins/org.eclipse.recommenders.webclient/src/org/eclipse/recommenders/webclient/exceptions/ServerErrorException.java42
-rw-r--r--plugins/org.eclipse.recommenders.webclient/src/org/eclipse/recommenders/webclient/exceptions/ServerUnreachableException.java48
-rw-r--r--plugins/org.eclipse.recommenders.webclient/src/org/eclipse/recommenders/webclient/exceptions/UnauthorizedAccessException.java42
-rw-r--r--plugins/org.eclipse.recommenders.webclient/src/org/eclipse/recommenders/webclient/results/GenericResultObjectView.java66
-rw-r--r--plugins/org.eclipse.recommenders.webclient/src/org/eclipse/recommenders/webclient/results/GenericResultRowView.java2
-rw-r--r--plugins/org.eclipse.recommenders.webclient/src/org/eclipse/recommenders/webclient/results/ResultObject.java56
-rw-r--r--plugins/org.eclipse.recommenders.webclient/src/org/eclipse/recommenders/webclient/results/TransactionResult.java40
-rw-r--r--pom.xml688
-rw-r--r--tests/org.eclipse.recommenders.tests.completion.rcp/pom.xml66
-rw-r--r--tests/org.eclipse.recommenders.tests.completion.rcp/src/org/eclipse/recommenders/tests/completion/rcp/ProposalComparator.java2
-rw-r--r--tests/org.eclipse.recommenders.tests.completion.rcp/src/org/eclipse/recommenders/tests/completion/rcp/subwords/SubwordsCompletionProposalComputerTest.java198
-rw-r--r--tests/org.eclipse.recommenders.tests.completion.rcp/src/org/eclipse/recommenders/tests/completion/rcp/subwords/SubwordsCompletionRequestorTest.java250
-rw-r--r--tests/org.eclipse.recommenders.tests.completion.rcp/src/org/eclipse/recommenders/tests/completion/rcp/subwords/SubwordsMockUtils.java264
-rw-r--r--tests/org.eclipse.recommenders.tests.extdoc.rcp/.classpath14
-rw-r--r--tests/org.eclipse.recommenders.tests.extdoc.rcp/build.properties30
-rw-r--r--tests/org.eclipse.recommenders.tests.extdoc.rcp/pom.xml54
-rw-r--r--tests/org.eclipse.recommenders.tests.extdoc.rcp/src/org/eclipse/recommenders/tests/extdoc/ExtdocDnDTest.java2
-rw-r--r--tests/org.eclipse.recommenders.tests.extdoc.rcp/src/org/eclipse/recommenders/tests/extdoc/ExtdocProviderStoreTest.java2
-rw-r--r--tests/org.eclipse.recommenders.tests.extdoc.rcp/src/org/eclipse/recommenders/tests/extdoc/ExtdocProviderTest.java2
-rw-r--r--tests/org.eclipse.recommenders.tests.extdoc.rcp/src/org/eclipse/recommenders/tests/extdoc/JavaSelectionTestUtils.java2
-rw-r--r--tests/org.eclipse.recommenders.tests.extdoc.rcp/src/org/eclipse/recommenders/tests/extdoc/ProviderImplementation.java2
-rw-r--r--tests/org.eclipse.recommenders.tests.extdoc.rcp/src/org/eclipse/recommenders/tests/extdoc/SubscriptionManagerTest.java2
-rw-r--r--tests/org.eclipse.recommenders.tests.extdoc.rcp/src/org/eclipse/recommenders/tests/extdoc/SubscriptionVerifier.java2
-rw-r--r--tests/org.eclipse.recommenders.tests.rcp/pom.xml64
-rw-r--r--tests/org.eclipse.recommenders.tests.rcp/src/org/eclipse/recommenders/tests/rcp/providers/JavaElementSelectionTest.xtend240
-rw-r--r--tests/org.eclipse.recommenders.tests.rcp/src/org/eclipse/recommenders/tests/rcp/providers/JavaSelectionLocationTest.xtend342
-rw-r--r--tests/org.eclipse.recommenders.tests.rcp/src/org/eclipse/recommenders/tests/rcp/providers/helper/JavaSelectionListenerSpy.java2
-rw-r--r--tests/org.eclipse.recommenders.tests.rcp/src/org/eclipse/recommenders/tests/rcp/providers/helper/JavaSelectionTestUtils.java2
-rw-r--r--tests/org.eclipse.recommenders.tests.rcp/src/org/eclipse/recommenders/tests/rcp/repo/ProxySelectorTest.java2
-rw-r--r--tests/org.eclipse.recommenders.tests.rdk/src/org/eclipse/recommenders/rdk/utils/SettingsTest.java2
-rw-r--r--tests/org.eclipse.recommenders.tests.snipmatch.rcp/.classpath14
-rw-r--r--tests/org.eclipse.recommenders.tests.snipmatch.rcp/.project56
-rw-r--r--tests/org.eclipse.recommenders.tests.snipmatch.rcp/META-INF/MANIFEST.MF24
-rw-r--r--tests/org.eclipse.recommenders.tests.snipmatch.rcp/build.properties8
-rw-r--r--tests/org.eclipse.recommenders.tests.snipmatch.rcp/pom.xml18
-rw-r--r--tests/org.eclipse.recommenders.tests.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/ArgumentMatchNodeTest.java268
-rw-r--r--tests/org.eclipse.recommenders.tests.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/EffectMatchNodeTest.java216
-rw-r--r--tests/org.eclipse.recommenders.tests.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/EffectParameterTest.java346
-rw-r--r--tests/org.eclipse.recommenders.tests.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/EffectTest.java816
-rw-r--r--tests/org.eclipse.recommenders.tests.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/FormulaSnippetNodeTest.java258
-rw-r--r--tests/org.eclipse.recommenders.tests.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/SnippetParserTest.java356
-rw-r--r--tests/org.eclipse.recommenders.tests.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/core/TextSnippetNodeTest.java268
-rw-r--r--tests/org.eclipse.recommenders.tests.util/pom.xml20
-rw-r--r--tests/org.eclipse.recommenders.tests.util/src/org/eclipse/recommenders/tests/internal/analysis/archive/FilenameExtractionTest.java64
-rw-r--r--tests/org.eclipse.recommenders.tests.util/src/org/eclipse/recommenders/tests/internal/analysis/archive/ManifestExtractionTest.java174
-rw-r--r--tests/org.eclipse.recommenders.tests.util/src/org/eclipse/recommenders/tests/internal/analysis/archive/PomExtractionTest.java144
-rw-r--r--tests/org.eclipse.recommenders.tests.util/src/org/eclipse/recommenders/tests/internal/analysis/archive/TypeCompilationExtractionTest.java108
-rw-r--r--tests/org.eclipse.recommenders.tests.util/src/org/eclipse/recommenders/utils/ThrowsTest.java154
-rw-r--r--tests/org.eclipse.recommenders.tests.util/src/org/eclipse/recommenders/utils/VersionRangeTest.java526
-rw-r--r--tests/org.eclipse.recommenders.tests.util/src/org/eclipse/recommenders/utils/VersionTest.java202
-rw-r--r--tests/org.eclipse.recommenders.tests.util/src/org/eclipse/recommenders/utils/gson/GsonDateFormatTest.java124
-rw-r--r--tests/org.eclipse.recommenders.tests.util/src/org/eclipse/recommenders/utils/gson/GsonTestStruct.java88
-rw-r--r--tests/org.eclipse.recommenders.tests.util/src/org/eclipse/recommenders/utils/gson/GsonUtilTest.java366
-rw-r--r--tests/org.eclipse.recommenders.tests.util/src/org/eclipse/recommenders/utils/names/VmTypeNameTest.java460
-rw-r--r--tests/org.eclipse.recommenders.tests.util/src/org/eclipse/recommenders/utils/parser/MavenVersionParserTest.java196
-rw-r--r--tests/org.eclipse.recommenders.tests.util/src/org/eclipse/recommenders/utils/parser/OsgiVersionParserTest.java166
-rw-r--r--tests/org.eclipse.recommenders.tests.webclient/pom.xml20
-rw-r--r--tests/org.eclipse.recommenders.tests.webclient/src/org/eclipse/recommenders/tests/webclient/CouchUtilsTest.java170
-rw-r--r--tests/org.eclipse.recommenders.tests/pom.xml20
-rw-r--r--tests/org.eclipse.recommenders.tests/src/org/eclipse/recommenders/tests/CodeBuilder.xtend238
-rw-r--r--tests/org.eclipse.recommenders.tests/src/org/eclipse/recommenders/tests/XtendUtils.java60
-rw-r--r--tests/org.eclipse.recommenders.tests/src/org/eclipse/recommenders/tests/jdt/JavaProjectFixtureTest.java2
-rw-r--r--tests/org.eclipse.recommenders.tests/src/org/eclipse/recommenders/tests/jdt/SimpleCompletionRequestor.java2
370 files changed, 29846 insertions, 29846 deletions
diff --git a/dist/org.eclipse.recommenders.repository.rcp.dev.e37/index.php b/dist/org.eclipse.recommenders.repository.rcp.dev.e37/index.php
index 88a3769..6942d57 100644
--- a/dist/org.eclipse.recommenders.repository.rcp.dev.e37/index.php
+++ b/dist/org.eclipse.recommenders.repository.rcp.dev.e37/index.php
@@ -1,86 +1,86 @@
-<html>
- <head>
- <title>Update-Site</title>
- </head>
- <body>
- <div style="max-width: 900px;">
- <hr />
- <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
- <h1>Welcome!</h1>
- This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
- To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
- <br style="clear: both;" />
- <hr />
- </div>
-
-<?php
-
- $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
- printDir($pathElements, 0);
-
-
- function printDir($pathElements, $pathDepth) {
- $rootdir = getDirectory($pathElements, $pathDepth);
- $files = readFiles("./".$rootdir);
- $dirs = readDirectories("./".$rootdir);
- sort($files);
- sort($dirs);
-
- echo "<ul>";
-
- foreach($dirs as $dir) {
- echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
-
- if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
- printDir($pathElements, $pathDepth+1);
- }
- }
-
- foreach($files as $file) {
- echo '<li>'.$file.'</li>';
- }
-
- echo "</ul>";
- }
-
- function printIndent($depth) {
- for($i=0; $i<$depth; $i++)
- echo "&nbsp;";
- }
-
- function getDirectory($pathElements, $pathDepth) {
- $dir = "";
- for($i=0; $i<$pathDepth; $i++) {
- $dir .= $pathElements[$i]."/";
- }
- return $dir;
- }
-
- function readDirectories($dir) {
- $dirs = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_dir($dir.$file))
- $dirs[] = $file;
- }
- }
- return $dirs;
- }
-
- function readFiles($dir) {
- $files = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
- $files[] = $file;
- }
- }
- return $files;
- }
-?>
- </body>
+<html>
+ <head>
+ <title>Update-Site</title>
+ </head>
+ <body>
+ <div style="max-width: 900px;">
+ <hr />
+ <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
+ <h1>Welcome!</h1>
+ This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
+ To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
+ <br style="clear: both;" />
+ <hr />
+ </div>
+
+<?php
+
+ $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
+ printDir($pathElements, 0);
+
+
+ function printDir($pathElements, $pathDepth) {
+ $rootdir = getDirectory($pathElements, $pathDepth);
+ $files = readFiles("./".$rootdir);
+ $dirs = readDirectories("./".$rootdir);
+ sort($files);
+ sort($dirs);
+
+ echo "<ul>";
+
+ foreach($dirs as $dir) {
+ echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
+
+ if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
+ printDir($pathElements, $pathDepth+1);
+ }
+ }
+
+ foreach($files as $file) {
+ echo '<li>'.$file.'</li>';
+ }
+
+ echo "</ul>";
+ }
+
+ function printIndent($depth) {
+ for($i=0; $i<$depth; $i++)
+ echo "&nbsp;";
+ }
+
+ function getDirectory($pathElements, $pathDepth) {
+ $dir = "";
+ for($i=0; $i<$pathDepth; $i++) {
+ $dir .= $pathElements[$i]."/";
+ }
+ return $dir;
+ }
+
+ function readDirectories($dir) {
+ $dirs = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_dir($dir.$file))
+ $dirs[] = $file;
+ }
+ }
+ return $dirs;
+ }
+
+ function readFiles($dir) {
+ $files = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
+ $files[] = $file;
+ }
+ }
+ return $files;
+ }
+?>
+ </body>
</html> \ No newline at end of file
diff --git a/dist/org.eclipse.recommenders.repository.rcp.dev.e37/pom.xml b/dist/org.eclipse.recommenders.repository.rcp.dev.e37/pom.xml
index ab7cf6e..9c179e4 100644
--- a/dist/org.eclipse.recommenders.repository.rcp.dev.e37/pom.xml
+++ b/dist/org.eclipse.recommenders.repository.rcp.dev.e37/pom.xml
@@ -1,13 +1,13 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.repository</groupId>
- <artifactId>org.eclipse.recommenders.repository.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.repository</groupId>
+ <artifactId>org.eclipse.recommenders.repository.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.repository.rcp.dev.e37</artifactId>
- <packaging>eclipse-repository</packaging>
- <name>Code Recommenders: Eclipse 3.7 Dev Update Site</name>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.repository.rcp.dev.e37</artifactId>
+ <packaging>eclipse-repository</packaging>
+ <name>Code Recommenders: Eclipse 3.7 Dev Update Site</name>
</project> \ No newline at end of file
diff --git a/dist/org.eclipse.recommenders.repository.rcp.dev.e42/index.php b/dist/org.eclipse.recommenders.repository.rcp.dev.e42/index.php
index 88a3769..6942d57 100644
--- a/dist/org.eclipse.recommenders.repository.rcp.dev.e42/index.php
+++ b/dist/org.eclipse.recommenders.repository.rcp.dev.e42/index.php
@@ -1,86 +1,86 @@
-<html>
- <head>
- <title>Update-Site</title>
- </head>
- <body>
- <div style="max-width: 900px;">
- <hr />
- <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
- <h1>Welcome!</h1>
- This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
- To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
- <br style="clear: both;" />
- <hr />
- </div>
-
-<?php
-
- $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
- printDir($pathElements, 0);
-
-
- function printDir($pathElements, $pathDepth) {
- $rootdir = getDirectory($pathElements, $pathDepth);
- $files = readFiles("./".$rootdir);
- $dirs = readDirectories("./".$rootdir);
- sort($files);
- sort($dirs);
-
- echo "<ul>";
-
- foreach($dirs as $dir) {
- echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
-
- if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
- printDir($pathElements, $pathDepth+1);
- }
- }
-
- foreach($files as $file) {
- echo '<li>'.$file.'</li>';
- }
-
- echo "</ul>";
- }
-
- function printIndent($depth) {
- for($i=0; $i<$depth; $i++)
- echo "&nbsp;";
- }
-
- function getDirectory($pathElements, $pathDepth) {
- $dir = "";
- for($i=0; $i<$pathDepth; $i++) {
- $dir .= $pathElements[$i]."/";
- }
- return $dir;
- }
-
- function readDirectories($dir) {
- $dirs = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_dir($dir.$file))
- $dirs[] = $file;
- }
- }
- return $dirs;
- }
-
- function readFiles($dir) {
- $files = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
- $files[] = $file;
- }
- }
- return $files;
- }
-?>
- </body>
+<html>
+ <head>
+ <title>Update-Site</title>
+ </head>
+ <body>
+ <div style="max-width: 900px;">
+ <hr />
+ <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
+ <h1>Welcome!</h1>
+ This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
+ To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
+ <br style="clear: both;" />
+ <hr />
+ </div>
+
+<?php
+
+ $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
+ printDir($pathElements, 0);
+
+
+ function printDir($pathElements, $pathDepth) {
+ $rootdir = getDirectory($pathElements, $pathDepth);
+ $files = readFiles("./".$rootdir);
+ $dirs = readDirectories("./".$rootdir);
+ sort($files);
+ sort($dirs);
+
+ echo "<ul>";
+
+ foreach($dirs as $dir) {
+ echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
+
+ if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
+ printDir($pathElements, $pathDepth+1);
+ }
+ }
+
+ foreach($files as $file) {
+ echo '<li>'.$file.'</li>';
+ }
+
+ echo "</ul>";
+ }
+
+ function printIndent($depth) {
+ for($i=0; $i<$depth; $i++)
+ echo "&nbsp;";
+ }
+
+ function getDirectory($pathElements, $pathDepth) {
+ $dir = "";
+ for($i=0; $i<$pathDepth; $i++) {
+ $dir .= $pathElements[$i]."/";
+ }
+ return $dir;
+ }
+
+ function readDirectories($dir) {
+ $dirs = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_dir($dir.$file))
+ $dirs[] = $file;
+ }
+ }
+ return $dirs;
+ }
+
+ function readFiles($dir) {
+ $files = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
+ $files[] = $file;
+ }
+ }
+ return $files;
+ }
+?>
+ </body>
</html> \ No newline at end of file
diff --git a/dist/org.eclipse.recommenders.repository.rcp.dev.e42/pom.xml b/dist/org.eclipse.recommenders.repository.rcp.dev.e42/pom.xml
index 0fa7f83..0f6f929 100644
--- a/dist/org.eclipse.recommenders.repository.rcp.dev.e42/pom.xml
+++ b/dist/org.eclipse.recommenders.repository.rcp.dev.e42/pom.xml
@@ -1,13 +1,13 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.repository</groupId>
- <artifactId>org.eclipse.recommenders.repository.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.repository</groupId>
+ <artifactId>org.eclipse.recommenders.repository.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.repository.rcp.dev.e42</artifactId>
- <packaging>eclipse-repository</packaging>
- <name>Code Recommenders: Eclipse 4.2 Dev Update Site</name>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.repository.rcp.dev.e42</artifactId>
+ <packaging>eclipse-repository</packaging>
+ <name>Code Recommenders: Eclipse 4.2 Dev Update Site</name>
</project> \ No newline at end of file
diff --git a/dist/org.eclipse.recommenders.repository.rcp.head.e37/index.php b/dist/org.eclipse.recommenders.repository.rcp.head.e37/index.php
index 88a3769..6942d57 100644
--- a/dist/org.eclipse.recommenders.repository.rcp.head.e37/index.php
+++ b/dist/org.eclipse.recommenders.repository.rcp.head.e37/index.php
@@ -1,86 +1,86 @@
-<html>
- <head>
- <title>Update-Site</title>
- </head>
- <body>
- <div style="max-width: 900px;">
- <hr />
- <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
- <h1>Welcome!</h1>
- This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
- To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
- <br style="clear: both;" />
- <hr />
- </div>
-
-<?php
-
- $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
- printDir($pathElements, 0);
-
-
- function printDir($pathElements, $pathDepth) {
- $rootdir = getDirectory($pathElements, $pathDepth);
- $files = readFiles("./".$rootdir);
- $dirs = readDirectories("./".$rootdir);
- sort($files);
- sort($dirs);
-
- echo "<ul>";
-
- foreach($dirs as $dir) {
- echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
-
- if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
- printDir($pathElements, $pathDepth+1);
- }
- }
-
- foreach($files as $file) {
- echo '<li>'.$file.'</li>';
- }
-
- echo "</ul>";
- }
-
- function printIndent($depth) {
- for($i=0; $i<$depth; $i++)
- echo "&nbsp;";
- }
-
- function getDirectory($pathElements, $pathDepth) {
- $dir = "";
- for($i=0; $i<$pathDepth; $i++) {
- $dir .= $pathElements[$i]."/";
- }
- return $dir;
- }
-
- function readDirectories($dir) {
- $dirs = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_dir($dir.$file))
- $dirs[] = $file;
- }
- }
- return $dirs;
- }
-
- function readFiles($dir) {
- $files = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
- $files[] = $file;
- }
- }
- return $files;
- }
-?>
- </body>
+<html>
+ <head>
+ <title>Update-Site</title>
+ </head>
+ <body>
+ <div style="max-width: 900px;">
+ <hr />
+ <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
+ <h1>Welcome!</h1>
+ This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
+ To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
+ <br style="clear: both;" />
+ <hr />
+ </div>
+
+<?php
+
+ $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
+ printDir($pathElements, 0);
+
+
+ function printDir($pathElements, $pathDepth) {
+ $rootdir = getDirectory($pathElements, $pathDepth);
+ $files = readFiles("./".$rootdir);
+ $dirs = readDirectories("./".$rootdir);
+ sort($files);
+ sort($dirs);
+
+ echo "<ul>";
+
+ foreach($dirs as $dir) {
+ echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
+
+ if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
+ printDir($pathElements, $pathDepth+1);
+ }
+ }
+
+ foreach($files as $file) {
+ echo '<li>'.$file.'</li>';
+ }
+
+ echo "</ul>";
+ }
+
+ function printIndent($depth) {
+ for($i=0; $i<$depth; $i++)
+ echo "&nbsp;";
+ }
+
+ function getDirectory($pathElements, $pathDepth) {
+ $dir = "";
+ for($i=0; $i<$pathDepth; $i++) {
+ $dir .= $pathElements[$i]."/";
+ }
+ return $dir;
+ }
+
+ function readDirectories($dir) {
+ $dirs = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_dir($dir.$file))
+ $dirs[] = $file;
+ }
+ }
+ return $dirs;
+ }
+
+ function readFiles($dir) {
+ $files = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
+ $files[] = $file;
+ }
+ }
+ return $files;
+ }
+?>
+ </body>
</html> \ No newline at end of file
diff --git a/dist/org.eclipse.recommenders.repository.rcp.head.e37/pom.xml b/dist/org.eclipse.recommenders.repository.rcp.head.e37/pom.xml
index 4ee542f..622267b 100644
--- a/dist/org.eclipse.recommenders.repository.rcp.head.e37/pom.xml
+++ b/dist/org.eclipse.recommenders.repository.rcp.head.e37/pom.xml
@@ -1,13 +1,13 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.repository</groupId>
- <artifactId>org.eclipse.recommenders.repository.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.repository</groupId>
+ <artifactId>org.eclipse.recommenders.repository.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.repository.rcp.head.e37</artifactId>
- <packaging>eclipse-repository</packaging>
- <name>Code Recommenders: Eclipse 3.7 Head Update Site</name>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.repository.rcp.head.e37</artifactId>
+ <packaging>eclipse-repository</packaging>
+ <name>Code Recommenders: Eclipse 3.7 Head Update Site</name>
</project> \ No newline at end of file
diff --git a/dist/org.eclipse.recommenders.repository.rcp.head.e42/index.php b/dist/org.eclipse.recommenders.repository.rcp.head.e42/index.php
index 88a3769..6942d57 100644
--- a/dist/org.eclipse.recommenders.repository.rcp.head.e42/index.php
+++ b/dist/org.eclipse.recommenders.repository.rcp.head.e42/index.php
@@ -1,86 +1,86 @@
-<html>
- <head>
- <title>Update-Site</title>
- </head>
- <body>
- <div style="max-width: 900px;">
- <hr />
- <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
- <h1>Welcome!</h1>
- This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
- To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
- <br style="clear: both;" />
- <hr />
- </div>
-
-<?php
-
- $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
- printDir($pathElements, 0);
-
-
- function printDir($pathElements, $pathDepth) {
- $rootdir = getDirectory($pathElements, $pathDepth);
- $files = readFiles("./".$rootdir);
- $dirs = readDirectories("./".$rootdir);
- sort($files);
- sort($dirs);
-
- echo "<ul>";
-
- foreach($dirs as $dir) {
- echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
-
- if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
- printDir($pathElements, $pathDepth+1);
- }
- }
-
- foreach($files as $file) {
- echo '<li>'.$file.'</li>';
- }
-
- echo "</ul>";
- }
-
- function printIndent($depth) {
- for($i=0; $i<$depth; $i++)
- echo "&nbsp;";
- }
-
- function getDirectory($pathElements, $pathDepth) {
- $dir = "";
- for($i=0; $i<$pathDepth; $i++) {
- $dir .= $pathElements[$i]."/";
- }
- return $dir;
- }
-
- function readDirectories($dir) {
- $dirs = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_dir($dir.$file))
- $dirs[] = $file;
- }
- }
- return $dirs;
- }
-
- function readFiles($dir) {
- $files = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
- $files[] = $file;
- }
- }
- return $files;
- }
-?>
- </body>
+<html>
+ <head>
+ <title>Update-Site</title>
+ </head>
+ <body>
+ <div style="max-width: 900px;">
+ <hr />
+ <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
+ <h1>Welcome!</h1>
+ This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
+ To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
+ <br style="clear: both;" />
+ <hr />
+ </div>
+
+<?php
+
+ $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
+ printDir($pathElements, 0);
+
+
+ function printDir($pathElements, $pathDepth) {
+ $rootdir = getDirectory($pathElements, $pathDepth);
+ $files = readFiles("./".$rootdir);
+ $dirs = readDirectories("./".$rootdir);
+ sort($files);
+ sort($dirs);
+
+ echo "<ul>";
+
+ foreach($dirs as $dir) {
+ echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
+
+ if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
+ printDir($pathElements, $pathDepth+1);
+ }
+ }
+
+ foreach($files as $file) {
+ echo '<li>'.$file.'</li>';
+ }
+
+ echo "</ul>";
+ }
+
+ function printIndent($depth) {
+ for($i=0; $i<$depth; $i++)
+ echo "&nbsp;";
+ }
+
+ function getDirectory($pathElements, $pathDepth) {
+ $dir = "";
+ for($i=0; $i<$pathDepth; $i++) {
+ $dir .= $pathElements[$i]."/";
+ }
+ return $dir;
+ }
+
+ function readDirectories($dir) {
+ $dirs = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_dir($dir.$file))
+ $dirs[] = $file;
+ }
+ }
+ return $dirs;
+ }
+
+ function readFiles($dir) {
+ $files = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
+ $files[] = $file;
+ }
+ }
+ return $files;
+ }
+?>
+ </body>
</html> \ No newline at end of file
diff --git a/dist/org.eclipse.recommenders.repository.rcp.head.e42/pom.xml b/dist/org.eclipse.recommenders.repository.rcp.head.e42/pom.xml
index 16bde26..0be4336 100644
--- a/dist/org.eclipse.recommenders.repository.rcp.head.e42/pom.xml
+++ b/dist/org.eclipse.recommenders.repository.rcp.head.e42/pom.xml
@@ -1,13 +1,13 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.repository</groupId>
- <artifactId>org.eclipse.recommenders.repository.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.repository</groupId>
+ <artifactId>org.eclipse.recommenders.repository.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.repository.rcp.head.e42</artifactId>
- <packaging>eclipse-repository</packaging>
- <name>Code Recommenders: Eclipse 4.2 Head Update Site</name>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.repository.rcp.head.e42</artifactId>
+ <packaging>eclipse-repository</packaging>
+ <name>Code Recommenders: Eclipse 4.2 Head Update Site</name>
</project> \ No newline at end of file
diff --git a/dist/org.eclipse.recommenders.repository.rcp.train.e42/index.php b/dist/org.eclipse.recommenders.repository.rcp.train.e42/index.php
index 88a3769..6942d57 100644
--- a/dist/org.eclipse.recommenders.repository.rcp.train.e42/index.php
+++ b/dist/org.eclipse.recommenders.repository.rcp.train.e42/index.php
@@ -1,86 +1,86 @@
-<html>
- <head>
- <title>Update-Site</title>
- </head>
- <body>
- <div style="max-width: 900px;">
- <hr />
- <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
- <h1>Welcome!</h1>
- This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
- To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
- <br style="clear: both;" />
- <hr />
- </div>
-
-<?php
-
- $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
- printDir($pathElements, 0);
-
-
- function printDir($pathElements, $pathDepth) {
- $rootdir = getDirectory($pathElements, $pathDepth);
- $files = readFiles("./".$rootdir);
- $dirs = readDirectories("./".$rootdir);
- sort($files);
- sort($dirs);
-
- echo "<ul>";
-
- foreach($dirs as $dir) {
- echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
-
- if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
- printDir($pathElements, $pathDepth+1);
- }
- }
-
- foreach($files as $file) {
- echo '<li>'.$file.'</li>';
- }
-
- echo "</ul>";
- }
-
- function printIndent($depth) {
- for($i=0; $i<$depth; $i++)
- echo "&nbsp;";
- }
-
- function getDirectory($pathElements, $pathDepth) {
- $dir = "";
- for($i=0; $i<$pathDepth; $i++) {
- $dir .= $pathElements[$i]."/";
- }
- return $dir;
- }
-
- function readDirectories($dir) {
- $dirs = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_dir($dir.$file))
- $dirs[] = $file;
- }
- }
- return $dirs;
- }
-
- function readFiles($dir) {
- $files = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
- $files[] = $file;
- }
- }
- return $files;
- }
-?>
- </body>
+<html>
+ <head>
+ <title>Update-Site</title>
+ </head>
+ <body>
+ <div style="max-width: 900px;">
+ <hr />
+ <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
+ <h1>Welcome!</h1>
+ This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
+ To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
+ <br style="clear: both;" />
+ <hr />
+ </div>
+
+<?php
+
+ $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
+ printDir($pathElements, 0);
+
+
+ function printDir($pathElements, $pathDepth) {
+ $rootdir = getDirectory($pathElements, $pathDepth);
+ $files = readFiles("./".$rootdir);
+ $dirs = readDirectories("./".$rootdir);
+ sort($files);
+ sort($dirs);
+
+ echo "<ul>";
+
+ foreach($dirs as $dir) {
+ echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
+
+ if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
+ printDir($pathElements, $pathDepth+1);
+ }
+ }
+
+ foreach($files as $file) {
+ echo '<li>'.$file.'</li>';
+ }
+
+ echo "</ul>";
+ }
+
+ function printIndent($depth) {
+ for($i=0; $i<$depth; $i++)
+ echo "&nbsp;";
+ }
+
+ function getDirectory($pathElements, $pathDepth) {
+ $dir = "";
+ for($i=0; $i<$pathDepth; $i++) {
+ $dir .= $pathElements[$i]."/";
+ }
+ return $dir;
+ }
+
+ function readDirectories($dir) {
+ $dirs = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_dir($dir.$file))
+ $dirs[] = $file;
+ }
+ }
+ return $dirs;
+ }
+
+ function readFiles($dir) {
+ $files = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
+ $files[] = $file;
+ }
+ }
+ return $files;
+ }
+?>
+ </body>
</html> \ No newline at end of file
diff --git a/dist/org.eclipse.recommenders.repository.rcp.train.e42/pom.xml b/dist/org.eclipse.recommenders.repository.rcp.train.e42/pom.xml
index 7b63769..c0de6aa 100644
--- a/dist/org.eclipse.recommenders.repository.rcp.train.e42/pom.xml
+++ b/dist/org.eclipse.recommenders.repository.rcp.train.e42/pom.xml
@@ -1,89 +1,89 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.repository</groupId>
- <artifactId>org.eclipse.recommenders.repository.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.repository</groupId>
+ <artifactId>org.eclipse.recommenders.repository.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.repository.rcp.train</artifactId>
- <packaging>eclipse-repository</packaging>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.repository.rcp.train</artifactId>
+ <packaging>eclipse-repository</packaging>
<name>Code Recommenders: Juno Release Train Update Site</name>
<properties>
- <signer-input-directory>/home/data/httpd/download-staging.priv/technology/recommenders</signer-input-directory>
+ <signer-input-directory>/home/data/httpd/download-staging.priv/technology/recommenders</signer-input-directory>
<signing-plugin-version>1.0.5</signing-plugin-version>
</properties>
- <profiles>
- <profile>
- <id>build-server</id>
- <pluginRepositories>
- <pluginRepository>
- <id>eclipse</id>
- <layout>default</layout>
- <url>http://maven.eclipse.org/nexus/content/groups/public/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
- <build>
- <plugins>
-<plugin>
- <groupId>org.eclipse.dash.maven</groupId>
- <artifactId>eclipse-signing-maven-plugin</artifactId>
- <version>${signing-plugin-version}</version>
- <executions>
- <execution>
- <id>pack</id>
- <configuration>
- <inputFile>${project.build.directory}/${project.artifactId}-${project.version}.zip</inputFile>
- </configuration>
- <phase>integration-test</phase>
- <goals>
- <goal>pack</goal>
- </goals>
- </execution>
- <execution>
- <id>sign</id>
- <configuration>
- <inputFile>${project.build.directory}/packed/${project.artifactId}-${project.version}.zip</inputFile>
- <signerInputDirectory>${signer-input-directory}</signerInputDirectory>
- </configuration>
- <phase>integration-test</phase>
- <goals>
- <goal>sign</goal>
- </goals>
- </execution>
- <execution>
- <id>repack</id>
- <configuration>
- <inputFile>${project.build.directory}/signed/site_assembly.zip</inputFile>
- </configuration>
- <phase>integration-test</phase>
- <goals>
- <goal>pack</goal>
- </goals>
- </execution>
- <execution>
- <id>fixCheckSums</id>
- <configuration>
- <inputFile>${project.build.directory}/packed/site_assembly.zip</inputFile>
- </configuration>
- <phase>integration-test</phase>
- <goals>
- <goal>fixCheckSums</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <!--
+ <profiles>
+ <profile>
+ <id>build-server</id>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>eclipse</id>
+ <layout>default</layout>
+ <url>http://maven.eclipse.org/nexus/content/groups/public/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ <build>
+ <plugins>
+<plugin>
+ <groupId>org.eclipse.dash.maven</groupId>
+ <artifactId>eclipse-signing-maven-plugin</artifactId>
+ <version>${signing-plugin-version}</version>
+ <executions>
+ <execution>
+ <id>pack</id>
+ <configuration>
+ <inputFile>${project.build.directory}/${project.artifactId}-${project.version}.zip</inputFile>
+ </configuration>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>pack</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>sign</id>
+ <configuration>
+ <inputFile>${project.build.directory}/packed/${project.artifactId}-${project.version}.zip</inputFile>
+ <signerInputDirectory>${signer-input-directory}</signerInputDirectory>
+ </configuration>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>repack</id>
+ <configuration>
+ <inputFile>${project.build.directory}/signed/site_assembly.zip</inputFile>
+ </configuration>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>pack</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>fixCheckSums</id>
+ <configuration>
+ <inputFile>${project.build.directory}/packed/site_assembly.zip</inputFile>
+ </configuration>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>fixCheckSums</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!--
<plugin>
<groupId>org.eclipse.dash.maven</groupId>
- <artifactId>eclipse-signing-maven-plugin</artifactId>
+ <artifactId>eclipse-signing-maven-plugin</artifactId>
<version>1.0.4</version>
<executions>
<execution>
@@ -120,45 +120,45 @@
<execution>
<id>fixCheckSums</id>
<phase>package</phase>
- <configuration>
- <inputFile>${project.build.directory}/packed/site_assembly.zip</inputFile>
- </configuration>
+ <configuration>
+ <inputFile>${project.build.directory}/packed/site_assembly.zip</inputFile>
+ </configuration>
<goals>
<goal>fixCheckSums</goal>
</goals>
</execution>
</executions>
- </plugin>
-
- -->
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>deploy</id>
- <phase>install</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <delete includeemptydirs="true" failonerror="false">
- <fileset dir="target/repository/">
- <include name="**" />
- </fileset>
- </delete>
- <copy includeemptydirs="false" todir="target/repository">
- <fileset dir="target/checksumFix">
- <include name="**" />
- </fileset>
- </copy>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ </plugin>
+
+ -->
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>deploy</id>
+ <phase>install</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <delete includeemptydirs="true" failonerror="false">
+ <fileset dir="target/repository/">
+ <include name="**" />
+ </fileset>
+ </delete>
+ <copy includeemptydirs="false" todir="target/repository">
+ <fileset dir="target/checksumFix">
+ <include name="**" />
+ </fileset>
+ </copy>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project> \ No newline at end of file
diff --git a/dist/org.eclipse.recommenders.repository.rcp.train.e43/index.php b/dist/org.eclipse.recommenders.repository.rcp.train.e43/index.php
index 88a3769..6942d57 100644
--- a/dist/org.eclipse.recommenders.repository.rcp.train.e43/index.php
+++ b/dist/org.eclipse.recommenders.repository.rcp.train.e43/index.php
@@ -1,86 +1,86 @@
-<html>
- <head>
- <title>Update-Site</title>
- </head>
- <body>
- <div style="max-width: 900px;">
- <hr />
- <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
- <h1>Welcome!</h1>
- This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
- To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
- <br style="clear: both;" />
- <hr />
- </div>
-
-<?php
-
- $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
- printDir($pathElements, 0);
-
-
- function printDir($pathElements, $pathDepth) {
- $rootdir = getDirectory($pathElements, $pathDepth);
- $files = readFiles("./".$rootdir);
- $dirs = readDirectories("./".$rootdir);
- sort($files);
- sort($dirs);
-
- echo "<ul>";
-
- foreach($dirs as $dir) {
- echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
-
- if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
- printDir($pathElements, $pathDepth+1);
- }
- }
-
- foreach($files as $file) {
- echo '<li>'.$file.'</li>';
- }
-
- echo "</ul>";
- }
-
- function printIndent($depth) {
- for($i=0; $i<$depth; $i++)
- echo "&nbsp;";
- }
-
- function getDirectory($pathElements, $pathDepth) {
- $dir = "";
- for($i=0; $i<$pathDepth; $i++) {
- $dir .= $pathElements[$i]."/";
- }
- return $dir;
- }
-
- function readDirectories($dir) {
- $dirs = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_dir($dir.$file))
- $dirs[] = $file;
- }
- }
- return $dirs;
- }
-
- function readFiles($dir) {
- $files = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
- $files[] = $file;
- }
- }
- return $files;
- }
-?>
- </body>
+<html>
+ <head>
+ <title>Update-Site</title>
+ </head>
+ <body>
+ <div style="max-width: 900px;">
+ <hr />
+ <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
+ <h1>Welcome!</h1>
+ This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
+ To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
+ <br style="clear: both;" />
+ <hr />
+ </div>
+
+<?php
+
+ $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
+ printDir($pathElements, 0);
+
+
+ function printDir($pathElements, $pathDepth) {
+ $rootdir = getDirectory($pathElements, $pathDepth);
+ $files = readFiles("./".$rootdir);
+ $dirs = readDirectories("./".$rootdir);
+ sort($files);
+ sort($dirs);
+
+ echo "<ul>";
+
+ foreach($dirs as $dir) {
+ echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
+
+ if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
+ printDir($pathElements, $pathDepth+1);
+ }
+ }
+
+ foreach($files as $file) {
+ echo '<li>'.$file.'</li>';
+ }
+
+ echo "</ul>";
+ }
+
+ function printIndent($depth) {
+ for($i=0; $i<$depth; $i++)
+ echo "&nbsp;";
+ }
+
+ function getDirectory($pathElements, $pathDepth) {
+ $dir = "";
+ for($i=0; $i<$pathDepth; $i++) {
+ $dir .= $pathElements[$i]."/";
+ }
+ return $dir;
+ }
+
+ function readDirectories($dir) {
+ $dirs = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_dir($dir.$file))
+ $dirs[] = $file;
+ }
+ }
+ return $dirs;
+ }
+
+ function readFiles($dir) {
+ $files = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
+ $files[] = $file;
+ }
+ }
+ return $files;
+ }
+?>
+ </body>
</html> \ No newline at end of file
diff --git a/dist/org.eclipse.recommenders.repository.rcp.train.e43/pom.xml b/dist/org.eclipse.recommenders.repository.rcp.train.e43/pom.xml
index 9bdce76..3bba2e8 100644
--- a/dist/org.eclipse.recommenders.repository.rcp.train.e43/pom.xml
+++ b/dist/org.eclipse.recommenders.repository.rcp.train.e43/pom.xml
@@ -1,113 +1,113 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.repository</groupId>
- <artifactId>org.eclipse.recommenders.repository.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.repository</groupId>
+ <artifactId>org.eclipse.recommenders.repository.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.repository.rcp.train.e43</artifactId>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.repository.rcp.train.e43</artifactId>
<packaging>eclipse-repository</packaging>
- <name>Code Recommenders: Simultaneous Release Update Site</name>
+ <name>Code Recommenders: Simultaneous Release Update Site</name>
<properties>
- <signer-input-directory>/home/data/httpd/download-staging.priv/technology/recommenders</signer-input-directory>
+ <signer-input-directory>/home/data/httpd/download-staging.priv/technology/recommenders</signer-input-directory>
<signing-plugin-version>1.0.5</signing-plugin-version>
</properties>
- <profiles>
- <profile>
- <id>build-server</id>
- <pluginRepositories>
- <pluginRepository>
- <id>eclipse</id>
- <layout>default</layout>
- <url>http://maven.eclipse.org/nexus/content/groups/public/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
- <build>
- <plugins>
-<plugin>
- <groupId>org.eclipse.dash.maven</groupId>
- <artifactId>eclipse-signing-maven-plugin</artifactId>
- <version>${signing-plugin-version}</version>
- <executions>
- <execution>
- <id>pack</id>
- <configuration>
- <inputFile>${project.build.directory}/${project.artifactId}-${project.version}.zip</inputFile>
- </configuration>
- <phase>integration-test</phase>
- <goals>
- <goal>pack</goal>
- </goals>
- </execution>
- <execution>
- <id>sign</id>
- <configuration>
- <inputFile>${project.build.directory}/packed/${project.artifactId}-${project.version}.zip</inputFile>
- <signerInputDirectory>${signer-input-directory}</signerInputDirectory>
- </configuration>
- <phase>integration-test</phase>
- <goals>
- <goal>sign</goal>
- </goals>
- </execution>
- <execution>
- <id>repack</id>
- <configuration>
- <inputFile>${project.build.directory}/signed/site_assembly.zip</inputFile>
- </configuration>
- <phase>integration-test</phase>
- <goals>
- <goal>pack</goal>
- </goals>
- </execution>
- <execution>
- <id>fixCheckSums</id>
- <configuration>
- <inputFile>${project.build.directory}/packed/site_assembly.zip</inputFile>
- </configuration>
- <phase>integration-test</phase>
- <goals>
- <goal>fixCheckSums</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>deploy</id>
- <phase>install</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <delete includeemptydirs="true" failonerror="false">
- <fileset dir="target/repository/">
- <include name="**" />
- </fileset>
- </delete>
- <copy includeemptydirs="false" todir="target/repository">
- <fileset dir="target/checksumFix">
- <include name="**" />
- </fileset>
- </copy>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ <profiles>
+ <profile>
+ <id>build-server</id>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>eclipse</id>
+ <layout>default</layout>
+ <url>http://maven.eclipse.org/nexus/content/groups/public/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ <build>
+ <plugins>
+<plugin>
+ <groupId>org.eclipse.dash.maven</groupId>
+ <artifactId>eclipse-signing-maven-plugin</artifactId>
+ <version>${signing-plugin-version}</version>
+ <executions>
+ <execution>
+ <id>pack</id>
+ <configuration>
+ <inputFile>${project.build.directory}/${project.artifactId}-${project.version}.zip</inputFile>
+ </configuration>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>pack</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>sign</id>
+ <configuration>
+ <inputFile>${project.build.directory}/packed/${project.artifactId}-${project.version}.zip</inputFile>
+ <signerInputDirectory>${signer-input-directory}</signerInputDirectory>
+ </configuration>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>repack</id>
+ <configuration>
+ <inputFile>${project.build.directory}/signed/site_assembly.zip</inputFile>
+ </configuration>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>pack</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>fixCheckSums</id>
+ <configuration>
+ <inputFile>${project.build.directory}/packed/site_assembly.zip</inputFile>
+ </configuration>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>fixCheckSums</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>deploy</id>
+ <phase>install</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <delete includeemptydirs="true" failonerror="false">
+ <fileset dir="target/repository/">
+ <include name="**" />
+ </fileset>
+ </delete>
+ <copy includeemptydirs="false" todir="target/repository">
+ <fileset dir="target/checksumFix">
+ <include name="**" />
+ </fileset>
+ </copy>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project> \ No newline at end of file
diff --git a/dist/org.eclipse.recommenders.repository.rcp/index.php b/dist/org.eclipse.recommenders.repository.rcp/index.php
index 88a3769..6942d57 100644
--- a/dist/org.eclipse.recommenders.repository.rcp/index.php
+++ b/dist/org.eclipse.recommenders.repository.rcp/index.php
@@ -1,86 +1,86 @@
-<html>
- <head>
- <title>Update-Site</title>
- </head>
- <body>
- <div style="max-width: 900px;">
- <hr />
- <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
- <h1>Welcome!</h1>
- This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
- To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
- <br style="clear: both;" />
- <hr />
- </div>
-
-<?php
-
- $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
- printDir($pathElements, 0);
-
-
- function printDir($pathElements, $pathDepth) {
- $rootdir = getDirectory($pathElements, $pathDepth);
- $files = readFiles("./".$rootdir);
- $dirs = readDirectories("./".$rootdir);
- sort($files);
- sort($dirs);
-
- echo "<ul>";
-
- foreach($dirs as $dir) {
- echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
-
- if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
- printDir($pathElements, $pathDepth+1);
- }
- }
-
- foreach($files as $file) {
- echo '<li>'.$file.'</li>';
- }
-
- echo "</ul>";
- }
-
- function printIndent($depth) {
- for($i=0; $i<$depth; $i++)
- echo "&nbsp;";
- }
-
- function getDirectory($pathElements, $pathDepth) {
- $dir = "";
- for($i=0; $i<$pathDepth; $i++) {
- $dir .= $pathElements[$i]."/";
- }
- return $dir;
- }
-
- function readDirectories($dir) {
- $dirs = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_dir($dir.$file))
- $dirs[] = $file;
- }
- }
- return $dirs;
- }
-
- function readFiles($dir) {
- $files = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
- $files[] = $file;
- }
- }
- return $files;
- }
-?>
- </body>
+<html>
+ <head>
+ <title>Update-Site</title>
+ </head>
+ <body>
+ <div style="max-width: 900px;">
+ <hr />
+ <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
+ <h1>Welcome!</h1>
+ This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
+ To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
+ <br style="clear: both;" />
+ <hr />
+ </div>
+
+<?php
+
+ $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
+ printDir($pathElements, 0);
+
+
+ function printDir($pathElements, $pathDepth) {
+ $rootdir = getDirectory($pathElements, $pathDepth);
+ $files = readFiles("./".$rootdir);
+ $dirs = readDirectories("./".$rootdir);
+ sort($files);
+ sort($dirs);
+
+ echo "<ul>";
+
+ foreach($dirs as $dir) {
+ echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
+
+ if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
+ printDir($pathElements, $pathDepth+1);
+ }
+ }
+
+ foreach($files as $file) {
+ echo '<li>'.$file.'</li>';
+ }
+
+ echo "</ul>";
+ }
+
+ function printIndent($depth) {
+ for($i=0; $i<$depth; $i++)
+ echo "&nbsp;";
+ }
+
+ function getDirectory($pathElements, $pathDepth) {
+ $dir = "";
+ for($i=0; $i<$pathDepth; $i++) {
+ $dir .= $pathElements[$i]."/";
+ }
+ return $dir;
+ }
+
+ function readDirectories($dir) {
+ $dirs = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_dir($dir.$file))
+ $dirs[] = $file;
+ }
+ }
+ return $dirs;
+ }
+
+ function readFiles($dir) {
+ $files = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
+ $files[] = $file;
+ }
+ }
+ return $files;
+ }
+?>
+ </body>
</html> \ No newline at end of file
diff --git a/dist/org.eclipse.recommenders.repository.rcp/pom.xml b/dist/org.eclipse.recommenders.repository.rcp/pom.xml
index 954b27a..6012334 100644
--- a/dist/org.eclipse.recommenders.repository.rcp/pom.xml
+++ b/dist/org.eclipse.recommenders.repository.rcp/pom.xml
@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.repository</groupId>
- <artifactId>org.eclipse.recommenders.repository.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.repository</groupId>
+ <artifactId>org.eclipse.recommenders.repository.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.repository.rcp</artifactId>
- <packaging>eclipse-repository</packaging>
- <name>Code Recommenders: Eclipse 3.7 Head Update Site (deprecated URI)</name>
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-p2-repository-plugin</artifactId>
- <configuration>
- <includeAllDependencies>true</includeAllDependencies>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.repository.rcp</artifactId>
+ <packaging>eclipse-repository</packaging>
+ <name>Code Recommenders: Eclipse 3.7 Head Update Site (deprecated URI)</name>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-p2-repository-plugin</artifactId>
+ <configuration>
+ <includeAllDependencies>true</includeAllDependencies>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project> \ No newline at end of file
diff --git a/etc/eclipse/Checkstyle.xml b/etc/eclipse/Checkstyle.xml
index ed9f2ff..da9dc8f 100644
--- a/etc/eclipse/Checkstyle.xml
+++ b/etc/eclipse/Checkstyle.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
-<!--
- This configuration file was written by the eclipse-cs plugin configuration editor
+<!--
+ This configuration file was written by the eclipse-cs plugin configuration editor
-->
-<!--
- Checkstyle-Configuration: Eclipse Code Recommenders
- Description: none
+<!--
+ Checkstyle-Configuration: Eclipse Code Recommenders
+ Description: none
-->
<module name="Checker">
<property name="severity" value="warning"/>
diff --git a/etc/licenses/pom.xml b/etc/licenses/pom.xml
index c077fde..064f03a 100644
--- a/etc/licenses/pom.xml
+++ b/etc/licenses/pom.xml
@@ -1,14 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders</groupId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders</groupId>
<artifactId>org.eclipse.recommenders.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>license-headers</artifactId>
- <packaging>jar</packaging>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>license-headers</artifactId>
+ <packaging>jar</packaging>
+</project>
diff --git a/etc/licenses/src/main/resources/license-chengchen-2012.txt b/etc/licenses/src/main/resources/license-chengchen-2012.txt
index bd24602..0142a10 100644
--- a/etc/licenses/src/main/resources/license-chengchen-2012.txt
+++ b/etc/licenses/src/main/resources/license-chengchen-2012.txt
@@ -1,7 +1,7 @@
-Copyright (c) 2012 Cheng Chen
-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
-
+Copyright (c) 2012 Cheng Chen
+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: \ No newline at end of file
diff --git a/etc/licenses/src/main/resources/license-doug-ye-2011.txt b/etc/licenses/src/main/resources/license-doug-ye-2011.txt
index 7859cbf..61dc389 100644
--- a/etc/licenses/src/main/resources/license-doug-ye-2011.txt
+++ b/etc/licenses/src/main/resources/license-doug-ye-2011.txt
@@ -1,5 +1,5 @@
-Copyright (c) 2011 Doug Wightman, Zi Ye
-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
+Copyright (c) 2011 Doug Wightman, Zi Ye
+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 \ No newline at end of file
diff --git a/etc/licenses/src/main/resources/license-doug-ye-cheng.txt b/etc/licenses/src/main/resources/license-doug-ye-cheng.txt
index b8491a2..21072fd 100644
--- a/etc/licenses/src/main/resources/license-doug-ye-cheng.txt
+++ b/etc/licenses/src/main/resources/license-doug-ye-cheng.txt
@@ -1,7 +1,7 @@
-Copyright (c) 2011,2012 Doug Wightman, Zi Ye, Cheng Chen
-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
-
+Copyright (c) 2011,2012 Doug Wightman, Zi Ye, Cheng Chen
+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: \ No newline at end of file
diff --git a/etc/licenses/src/main/resources/license-frankenberger-2011.txt b/etc/licenses/src/main/resources/license-frankenberger-2011.txt
index 65d6180..ffbbad0 100644
--- a/etc/licenses/src/main/resources/license-frankenberger-2011.txt
+++ b/etc/licenses/src/main/resources/license-frankenberger-2011.txt
@@ -1,7 +1,7 @@
-Copyright (c) 2011 Andreas Frankenberger.
-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
-
+Copyright (c) 2011 Andreas Frankenberger.
+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: \ No newline at end of file
diff --git a/etc/scripts/index.php b/etc/scripts/index.php
index 88a3769..6942d57 100644
--- a/etc/scripts/index.php
+++ b/etc/scripts/index.php
@@ -1,86 +1,86 @@
-<html>
- <head>
- <title>Update-Site</title>
- </head>
- <body>
- <div style="max-width: 900px;">
- <hr />
- <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
- <h1>Welcome!</h1>
- This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
- To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
- <br style="clear: both;" />
- <hr />
- </div>
-
-<?php
-
- $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
- printDir($pathElements, 0);
-
-
- function printDir($pathElements, $pathDepth) {
- $rootdir = getDirectory($pathElements, $pathDepth);
- $files = readFiles("./".$rootdir);
- $dirs = readDirectories("./".$rootdir);
- sort($files);
- sort($dirs);
-
- echo "<ul>";
-
- foreach($dirs as $dir) {
- echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
-
- if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
- printDir($pathElements, $pathDepth+1);
- }
- }
-
- foreach($files as $file) {
- echo '<li>'.$file.'</li>';
- }
-
- echo "</ul>";
- }
-
- function printIndent($depth) {
- for($i=0; $i<$depth; $i++)
- echo "&nbsp;";
- }
-
- function getDirectory($pathElements, $pathDepth) {
- $dir = "";
- for($i=0; $i<$pathDepth; $i++) {
- $dir .= $pathElements[$i]."/";
- }
- return $dir;
- }
-
- function readDirectories($dir) {
- $dirs = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_dir($dir.$file))
- $dirs[] = $file;
- }
- }
- return $dirs;
- }
-
- function readFiles($dir) {
- $files = array();
- if ($handle = opendir($dir)) {
- while (false !== ($file = readdir($handle))) {
- if($file == "." || $file=="..")
- continue;
- if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
- $files[] = $file;
- }
- }
- return $files;
- }
-?>
- </body>
+<html>
+ <head>
+ <title>Update-Site</title>
+ </head>
+ <body>
+ <div style="max-width: 900px;">
+ <hr />
+ <img src="http://download.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" style="float: right; "/>
+ <h1>Welcome!</h1>
+ This is an <b>Eclipse Update Site</b>. To install the software hosted on this site, please use the Eclipse Update Manager.<br/>
+ To learn how to install software from an update site, please carefully read <a href="http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.user/tasks/tasks-127.htm">Adding a new software site</a> from Eclipse Online-Help and follow the instructions there.
+ <br style="clear: both;" />
+ <hr />
+ </div>
+
+<?php
+
+ $pathElements = array_key_exists('dir', $_GET) ? preg_split("/\//", $_GET['dir']) : array();
+ printDir($pathElements, 0);
+
+
+ function printDir($pathElements, $pathDepth) {
+ $rootdir = getDirectory($pathElements, $pathDepth);
+ $files = readFiles("./".$rootdir);
+ $dirs = readDirectories("./".$rootdir);
+ sort($files);
+ sort($dirs);
+
+ echo "<ul>";
+
+ foreach($dirs as $dir) {
+ echo '<li><a href="?dir='.$rootdir.$dir.'">'.$dir.'/</a></li>';
+
+ if(count($pathElements) > $pathDepth && $dir == $pathElements[$pathDepth]) {
+ printDir($pathElements, $pathDepth+1);
+ }
+ }
+
+ foreach($files as $file) {
+ echo '<li>'.$file.'</li>';
+ }
+
+ echo "</ul>";
+ }
+
+ function printIndent($depth) {
+ for($i=0; $i<$depth; $i++)
+ echo "&nbsp;";
+ }
+
+ function getDirectory($pathElements, $pathDepth) {
+ $dir = "";
+ for($i=0; $i<$pathDepth; $i++) {
+ $dir .= $pathElements[$i]."/";
+ }
+ return $dir;
+ }
+
+ function readDirectories($dir) {
+ $dirs = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_dir($dir.$file))
+ $dirs[] = $file;
+ }
+ }
+ return $dirs;
+ }
+
+ function readFiles($dir) {
+ $files = array();
+ if ($handle = opendir($dir)) {
+ while (false !== ($file = readdir($handle))) {
+ if($file == "." || $file=="..")
+ continue;
+ if(is_file($dir.$file) && !preg_match("/.*\.php/", $file))
+ $files[] = $file;
+ }
+ }
+ return $files;
+ }
+?>
+ </body>
</html> \ No newline at end of file
diff --git a/features/org.eclipse.recommenders.feature.3rd.orbit/pom.xml b/features/org.eclipse.recommenders.feature.3rd.orbit/pom.xml
index 37473eb..efd3783 100644
--- a/features/org.eclipse.recommenders.feature.3rd.orbit/pom.xml
+++ b/features/org.eclipse.recommenders.feature.3rd.orbit/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.feature.3rd.orbit</artifactId>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.feature.3rd.orbit</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.3rd.rcp.nonjuno/pom.xml b/features/org.eclipse.recommenders.feature.3rd.rcp.nonjuno/pom.xml
index 7bf8b0c..9a0d1d5 100644
--- a/features/org.eclipse.recommenders.feature.3rd.rcp.nonjuno/pom.xml
+++ b/features/org.eclipse.recommenders.feature.3rd.rcp.nonjuno/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.feature.3rd.rcp.nonjuno</artifactId>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.feature.3rd.rcp.nonjuno</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.3rd.rcp.nonorbit/pom.xml b/features/org.eclipse.recommenders.feature.3rd.rcp.nonorbit/pom.xml
index 719d205..6326798 100644
--- a/features/org.eclipse.recommenders.feature.3rd.rcp.nonorbit/pom.xml
+++ b/features/org.eclipse.recommenders.feature.3rd.rcp.nonorbit/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.feature.3rd.rcp.nonorbit</artifactId>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.feature.3rd.rcp.nonorbit</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.completion.rcp.chain.e37/build.properties b/features/org.eclipse.recommenders.feature.completion.rcp.chain.e37/build.properties
index 9561aae..31e861b 100644
--- a/features/org.eclipse.recommenders.feature.completion.rcp.chain.e37/build.properties
+++ b/features/org.eclipse.recommenders.feature.completion.rcp.chain.e37/build.properties
@@ -1,16 +1,16 @@
-#
-# Copyright (c) 2010 Darmstadt University of Technology.
-# 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:
-# Darmstadt University of Technology - initial API and implementation.
-#
-
-bin.includes = feature.xml,\
- feature.properties
-src.includes = feature.xml,\
- feature.properties,\
- pom.xml
+#
+# Copyright (c) 2010 Darmstadt University of Technology.
+# 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:
+# Darmstadt University of Technology - initial API and implementation.
+#
+
+bin.includes = feature.xml,\
+ feature.properties
+src.includes = feature.xml,\
+ feature.properties,\
+ pom.xml
diff --git a/features/org.eclipse.recommenders.feature.completion.rcp.chain.e37/pom.xml b/features/org.eclipse.recommenders.feature.completion.rcp.chain.e37/pom.xml
index 4d7f104..dc6a1d3 100644
--- a/features/org.eclipse.recommenders.feature.completion.rcp.chain.e37/pom.xml
+++ b/features/org.eclipse.recommenders.feature.completion.rcp.chain.e37/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.feature.completion.rcp.chain.e37</artifactId>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.feature.completion.rcp.chain.e37</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.completion.rcp.chain/build.properties b/features/org.eclipse.recommenders.feature.completion.rcp.chain/build.properties
index 6abd620..23fc039 100644
--- a/features/org.eclipse.recommenders.feature.completion.rcp.chain/build.properties
+++ b/features/org.eclipse.recommenders.feature.completion.rcp.chain/build.properties
@@ -1,16 +1,16 @@
-#
-# Copyright (c) 2010 Darmstadt University of Technology.
-# 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:
-# Darmstadt University of Technology - initial API and implementation.
-#
-
-bin.includes = feature.xml,\
- feature.properties
-src.includes = feature.xml,\
- feature.properties,\
- pom.xml
+#
+# Copyright (c) 2010 Darmstadt University of Technology.
+# 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:
+# Darmstadt University of Technology - initial API and implementation.
+#
+
+bin.includes = feature.xml,\
+ feature.properties
+src.includes = feature.xml,\
+ feature.properties,\
+ pom.xml
diff --git a/features/org.eclipse.recommenders.feature.completion.rcp.chain/pom.xml b/features/org.eclipse.recommenders.feature.completion.rcp.chain/pom.xml
index 26e5330..4d7143e 100644
--- a/features/org.eclipse.recommenders.feature.completion.rcp.chain/pom.xml
+++ b/features/org.eclipse.recommenders.feature.completion.rcp.chain/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.feature.completion.rcp.chain</artifactId>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.feature.completion.rcp.chain</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.completion.rcp.intellig.e37/build.properties b/features/org.eclipse.recommenders.feature.completion.rcp.intellig.e37/build.properties
index 6abd620..23fc039 100644
--- a/features/org.eclipse.recommenders.feature.completion.rcp.intellig.e37/build.properties
+++ b/features/org.eclipse.recommenders.feature.completion.rcp.intellig.e37/build.properties
@@ -1,16 +1,16 @@
-#
-# Copyright (c) 2010 Darmstadt University of Technology.
-# 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:
-# Darmstadt University of Technology - initial API and implementation.
-#
-
-bin.includes = feature.xml,\
- feature.properties
-src.includes = feature.xml,\
- feature.properties,\
- pom.xml
+#
+# Copyright (c) 2010 Darmstadt University of Technology.
+# 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:
+# Darmstadt University of Technology - initial API and implementation.
+#
+
+bin.includes = feature.xml,\
+ feature.properties
+src.includes = feature.xml,\
+ feature.properties,\
+ pom.xml
diff --git a/features/org.eclipse.recommenders.feature.completion.rcp.intellig.e37/pom.xml b/features/org.eclipse.recommenders.feature.completion.rcp.intellig.e37/pom.xml
index 9f4fdf8..04e8f0d 100644
--- a/features/org.eclipse.recommenders.feature.completion.rcp.intellig.e37/pom.xml
+++ b/features/org.eclipse.recommenders.feature.completion.rcp.intellig.e37/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.feature.completion.rcp.intellig.e37</artifactId>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.feature.completion.rcp.intellig.e37</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.completion.rcp.intellig/build.properties b/features/org.eclipse.recommenders.feature.completion.rcp.intellig/build.properties
index 6abd620..23fc039 100644
--- a/features/org.eclipse.recommenders.feature.completion.rcp.intellig/build.properties
+++ b/features/org.eclipse.recommenders.feature.completion.rcp.intellig/build.properties
@@ -1,16 +1,16 @@
-#
-# Copyright (c) 2010 Darmstadt University of Technology.
-# 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:
-# Darmstadt University of Technology - initial API and implementation.
-#
-
-bin.includes = feature.xml,\
- feature.properties
-src.includes = feature.xml,\
- feature.properties,\
- pom.xml
+#
+# Copyright (c) 2010 Darmstadt University of Technology.
+# 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:
+# Darmstadt University of Technology - initial API and implementation.
+#
+
+bin.includes = feature.xml,\
+ feature.properties
+src.includes = feature.xml,\
+ feature.properties,\
+ pom.xml
diff --git a/features/org.eclipse.recommenders.feature.completion.rcp.intellig/pom.xml b/features/org.eclipse.recommenders.feature.completion.rcp.intellig/pom.xml
index 0272c71..f5cdce3 100644
--- a/features/org.eclipse.recommenders.feature.completion.rcp.intellig/pom.xml
+++ b/features/org.eclipse.recommenders.feature.completion.rcp.intellig/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.feature.completion.rcp.intellig</artifactId>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.feature.completion.rcp.intellig</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.completion.rcp.sandbox/build.properties b/features/org.eclipse.recommenders.feature.completion.rcp.sandbox/build.properties
index 6abd620..23fc039 100644
--- a/features/org.eclipse.recommenders.feature.completion.rcp.sandbox/build.properties
+++ b/features/org.eclipse.recommenders.feature.completion.rcp.sandbox/build.properties
@@ -1,16 +1,16 @@
-#
-# Copyright (c) 2010 Darmstadt University of Technology.
-# 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:
-# Darmstadt University of Technology - initial API and implementation.
-#
-
-bin.includes = feature.xml,\
- feature.properties
-src.includes = feature.xml,\
- feature.properties,\
- pom.xml
+#
+# Copyright (c) 2010 Darmstadt University of Technology.
+# 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:
+# Darmstadt University of Technology - initial API and implementation.
+#
+
+bin.includes = feature.xml,\
+ feature.properties
+src.includes = feature.xml,\
+ feature.properties,\
+ pom.xml
diff --git a/features/org.eclipse.recommenders.feature.completion.rcp.sandbox/pom.xml b/features/org.eclipse.recommenders.feature.completion.rcp.sandbox/pom.xml
index 9527e68..bd009d4 100644
--- a/features/org.eclipse.recommenders.feature.completion.rcp.sandbox/pom.xml
+++ b/features/org.eclipse.recommenders.feature.completion.rcp.sandbox/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.feature.completion.rcp.sandbox</artifactId>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.feature.completion.rcp.sandbox</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.completion.rcp.subwords/build.properties b/features/org.eclipse.recommenders.feature.completion.rcp.subwords/build.properties
index 6abd620..23fc039 100644
--- a/features/org.eclipse.recommenders.feature.completion.rcp.subwords/build.properties
+++ b/features/org.eclipse.recommenders.feature.completion.rcp.subwords/build.properties
@@ -1,16 +1,16 @@
-#
-# Copyright (c) 2010 Darmstadt University of Technology.
-# 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:
-# Darmstadt University of Technology - initial API and implementation.
-#
-
-bin.includes = feature.xml,\
- feature.properties
-src.includes = feature.xml,\
- feature.properties,\
- pom.xml
+#
+# Copyright (c) 2010 Darmstadt University of Technology.
+# 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:
+# Darmstadt University of Technology - initial API and implementation.
+#
+
+bin.includes = feature.xml,\
+ feature.properties
+src.includes = feature.xml,\
+ feature.properties,\
+ pom.xml
diff --git a/features/org.eclipse.recommenders.feature.completion.rcp.subwords/pom.xml b/features/org.eclipse.recommenders.feature.completion.rcp.subwords/pom.xml
index 6b93d9a..cf53aa3 100644
--- a/features/org.eclipse.recommenders.feature.completion.rcp.subwords/pom.xml
+++ b/features/org.eclipse.recommenders.feature.completion.rcp.subwords/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.feature.completion.rcp.subwords</artifactId>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.feature.completion.rcp.subwords</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.extdoc.rcp/build.properties b/features/org.eclipse.recommenders.feature.extdoc.rcp/build.properties
index 6abd620..23fc039 100644
--- a/features/org.eclipse.recommenders.feature.extdoc.rcp/build.properties
+++ b/features/org.eclipse.recommenders.feature.extdoc.rcp/build.properties
@@ -1,16 +1,16 @@
-#
-# Copyright (c) 2010 Darmstadt University of Technology.
-# 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:
-# Darmstadt University of Technology - initial API and implementation.
-#
-
-bin.includes = feature.xml,\
- feature.properties
-src.includes = feature.xml,\
- feature.properties,\
- pom.xml
+#
+# Copyright (c) 2010 Darmstadt University of Technology.
+# 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:
+# Darmstadt University of Technology - initial API and implementation.
+#
+
+bin.includes = feature.xml,\
+ feature.properties
+src.includes = feature.xml,\
+ feature.properties,\
+ pom.xml
diff --git a/features/org.eclipse.recommenders.feature.extdoc.rcp/pom.xml b/features/org.eclipse.recommenders.feature.extdoc.rcp/pom.xml
index d8e431e..388b4cb 100644
--- a/features/org.eclipse.recommenders.feature.extdoc.rcp/pom.xml
+++ b/features/org.eclipse.recommenders.feature.extdoc.rcp/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.feature.extdoc.rcp</artifactId>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.feature.extdoc.rcp</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.license/pom.xml b/features/org.eclipse.recommenders.feature.license/pom.xml
index 7728a7d..00e8686 100644
--- a/features/org.eclipse.recommenders.feature.license/pom.xml
+++ b/features/org.eclipse.recommenders.feature.license/pom.xml
@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
- <version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.feature.license</artifactId>
- <packaging>eclipse-feature</packaging>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+ <version>1.0.3-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.feature.license</artifactId>
+ <packaging>eclipse-feature</packaging>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.rcp.core/build.properties b/features/org.eclipse.recommenders.feature.rcp.core/build.properties
index 6abd620..23fc039 100644
--- a/features/org.eclipse.recommenders.feature.rcp.core/build.properties
+++ b/features/org.eclipse.recommenders.feature.rcp.core/build.properties
@@ -1,16 +1,16 @@
-#
-# Copyright (c) 2010 Darmstadt University of Technology.
-# 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:
-# Darmstadt University of Technology - initial API and implementation.
-#
-
-bin.includes = feature.xml,\
- feature.properties
-src.includes = feature.xml,\
- feature.properties,\
- pom.xml
+#
+# Copyright (c) 2010 Darmstadt University of Technology.
+# 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:
+# Darmstadt University of Technology - initial API and implementation.
+#
+
+bin.includes = feature.xml,\
+ feature.properties
+src.includes = feature.xml,\
+ feature.properties,\
+ pom.xml
diff --git a/features/org.eclipse.recommenders.feature.rcp.core/pom.xml b/features/org.eclipse.recommenders.feature.rcp.core/pom.xml
index 0f22957..856b10a 100644
--- a/features/org.eclipse.recommenders.feature.rcp.core/pom.xml
+++ b/features/org.eclipse.recommenders.feature.rcp.core/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.feature.rcp.core</artifactId>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.feature.rcp.core</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.rcp/build.properties b/features/org.eclipse.recommenders.feature.rcp/build.properties
index 6abd620..23fc039 100644
--- a/features/org.eclipse.recommenders.feature.rcp/build.properties
+++ b/features/org.eclipse.recommenders.feature.rcp/build.properties
@@ -1,16 +1,16 @@
-#
-# Copyright (c) 2010 Darmstadt University of Technology.
-# 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:
-# Darmstadt University of Technology - initial API and implementation.
-#
-
-bin.includes = feature.xml,\
- feature.properties
-src.includes = feature.xml,\
- feature.properties,\
- pom.xml
+#
+# Copyright (c) 2010 Darmstadt University of Technology.
+# 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:
+# Darmstadt University of Technology - initial API and implementation.
+#
+
+bin.includes = feature.xml,\
+ feature.properties
+src.includes = feature.xml,\
+ feature.properties,\
+ pom.xml
diff --git a/features/org.eclipse.recommenders.feature.rcp/pom.xml b/features/org.eclipse.recommenders.feature.rcp/pom.xml
index 3b77961..42214e2 100644
--- a/features/org.eclipse.recommenders.feature.rcp/pom.xml
+++ b/features/org.eclipse.recommenders.feature.rcp/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.feature.rcp</artifactId>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.feature.rcp</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.rdk/pom.xml b/features/org.eclipse.recommenders.feature.rdk/pom.xml
index 757970d..b359a84 100644
--- a/features/org.eclipse.recommenders.feature.rdk/pom.xml
+++ b/features/org.eclipse.recommenders.feature.rdk/pom.xml
@@ -1,21 +1,21 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
<artifactId>org.eclipse.recommenders.feature.parent</artifactId>
- <version>1.0.3-SNAPSHOT</version>
- </parent>
- <artifactId>org.eclipse.recommenders.feature.rdk</artifactId>
- <version>1.0.3-SNAPSHOT</version>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ <version>1.0.3-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.recommenders.feature.rdk</artifactId>
+ <version>1.0.3-SNAPSHOT</version>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.snipmatch.rcp/.project b/features/org.eclipse.recommenders.feature.snipmatch.rcp/.project
index 8be0ebe..a40d961 100644
--- a/features/org.eclipse.recommenders.feature.snipmatch.rcp/.project
+++ b/features/org.eclipse.recommenders.feature.snipmatch.rcp/.project
@@ -1,17 +1,17 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.recommenders.feature.snipmatch.rcp</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.recommenders.feature.snipmatch.rcp</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/features/org.eclipse.recommenders.feature.snipmatch.rcp/build.properties b/features/org.eclipse.recommenders.feature.snipmatch.rcp/build.properties
index 36ac0b4..3022e7e 100644
--- a/features/org.eclipse.recommenders.feature.snipmatch.rcp/build.properties
+++ b/features/org.eclipse.recommenders.feature.snipmatch.rcp/build.properties
@@ -1,17 +1,17 @@
-#
-# Copyright (c) Cheng Chen.
-# 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:
-# Cheng Chen - initial API and implementation.
-#
-
-bin.includes = feature.xml,\
- feature.properties
-src.includes = feature.xml,\
- feature.properties,\
- pom.xml
-
+#
+# Copyright (c) Cheng Chen.
+# 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:
+# Cheng Chen - initial API and implementation.
+#
+
+bin.includes = feature.xml,\
+ feature.properties
+src.includes = feature.xml,\
+ feature.properties,\
+ pom.xml
+
diff --git a/features/org.eclipse.recommenders.feature.snipmatch.rcp/pom.xml b/features/org.eclipse.recommenders.feature.snipmatch.rcp/pom.xml
index f277a59..480e9c7 100644
--- a/features/org.eclipse.recommenders.feature.snipmatch.rcp/pom.xml
+++ b/features/org.eclipse.recommenders.feature.snipmatch.rcp/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.feature.snipmatch.rcp</artifactId>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.feature.snipmatch.rcp</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/features/org.eclipse.recommenders.feature.tests/pom.xml b/features/org.eclipse.recommenders.feature.tests/pom.xml
index 199eb00..f6bbc13 100644
--- a/features/org.eclipse.recommenders.feature.tests/pom.xml
+++ b/features/org.eclipse.recommenders.feature.tests/pom.xml
@@ -1,21 +1,21 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.eclipse.recommenders.feature</groupId>
- <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
- <version>1.0.3-SNAPSHOT</version>
- </parent>
- <artifactId>org.eclipse.recommenders.feature.tests</artifactId>
- <version>1.0.3-SNAPSHOT</version>
- <packaging>eclipse-feature</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.recommenders.feature</groupId>
+ <artifactId>org.eclipse.recommenders.feature.parent</artifactId>
+ <version>1.0.3-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.recommenders.feature.tests</artifactId>
+ <version>1.0.3-SNAPSHOT</version>
+ <packaging>eclipse-feature</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/plugin.xml b/plugins/org.eclipse.recommenders.completion.rcp.calls/plugin.xml
index 1e3c0bc..5b94d0d 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/plugin.xml
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/plugin.xml
@@ -1,53 +1,53 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.recommenders.injection.modules">
- <module
- class="org.eclipse.recommenders.internal.completion.rcp.calls.wiring.CallsCompletionModule">
- </module>
- </extension>
- <extension
- id="org.eclipse.recommenders"
- name="%extension.name"
- point="org.eclipse.jdt.ui.javaCompletionProposalComputer">
- <javaCompletionProposalComputer
- activate="false"
- categoryId="org.eclipse.recommenders.rcp.category.completion"
- class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.calls.engine.CallsCompletionProposalComputer">
- </javaCompletionProposalComputer>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="org.eclipse.recommenders.rcp.category.preferences"
- class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.calls.preferences.CallPreferencePage"
- id="org.eclipse.recommenders.calls.rcp.dependencies"
- name="%page.name">
- </page>
- </extension>
- <extension
- point="org.eclipse.core.runtime.preferences">
- <initializer
- class="org.eclipse.recommenders.internal.completion.rcp.calls.preferences.PreferenceInitializer">
- </initializer>
- </extension>
- <extension
- point="org.eclipse.recommenders.extdoc.rcp.provider">
- <provider
- class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.calls.extdoc.CallsProvider"
- image="icons/obj16/calls.png"
- name="Calls Recommender">
- </provider>
- </extension>
- <extension
- point="org.eclipse.recommenders.completion.rcp.sessionprocessors">
- <processor
- class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.calls.engine.CallsSessionProcessor"
- icon="icons/obj16/calls.gif"
- id="org.eclipse.recommenders.completion.rcp.calls.processor"
- name="Calls">
- </processor>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.recommenders.injection.modules">
+ <module
+ class="org.eclipse.recommenders.internal.completion.rcp.calls.wiring.CallsCompletionModule">
+ </module>
+ </extension>
+ <extension
+ id="org.eclipse.recommenders"
+ name="%extension.name"
+ point="org.eclipse.jdt.ui.javaCompletionProposalComputer">
+ <javaCompletionProposalComputer
+ activate="false"
+ categoryId="org.eclipse.recommenders.rcp.category.completion"
+ class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.calls.engine.CallsCompletionProposalComputer">
+ </javaCompletionProposalComputer>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.recommenders.rcp.category.preferences"
+ class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.calls.preferences.CallPreferencePage"
+ id="org.eclipse.recommenders.calls.rcp.dependencies"
+ name="%page.name">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.recommenders.internal.completion.rcp.calls.preferences.PreferenceInitializer">
+ </initializer>
+ </extension>
+ <extension
+ point="org.eclipse.recommenders.extdoc.rcp.provider">
+ <provider
+ class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.calls.extdoc.CallsProvider"
+ image="icons/obj16/calls.png"
+ name="Calls Recommender">
+ </provider>
+ </extension>
+ <extension
+ point="org.eclipse.recommenders.completion.rcp.sessionprocessors">
+ <processor
+ class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.calls.engine.CallsSessionProcessor"
+ icon="icons/obj16/calls.gif"
+ id="org.eclipse.recommenders.completion.rcp.calls.processor"
+ name="Calls">
+ </processor>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/pom.xml b/plugins/org.eclipse.recommenders.completion.rcp.calls/pom.xml
index 3d41640..3585001 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/pom.xml
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.plugin</groupId>
- <artifactId>org.eclipse.recommenders.plugin.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.plugin</groupId>
+ <artifactId>org.eclipse.recommenders.plugin.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.completion.rcp.calls</artifactId>
- <packaging>eclipse-plugin</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.completion.rcp.calls</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/AstBasedObjectUsageResolver.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/AstBasedObjectUsageResolver.java
index db093d7..4e9b08d 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/AstBasedObjectUsageResolver.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/AstBasedObjectUsageResolver.java
@@ -484,4 +484,4 @@ public class AstBasedObjectUsageResolver extends ASTVisitor {
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsCompletionProposalComputer.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsCompletionProposalComputer.java
index af7acfc..a2d1aa4 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsCompletionProposalComputer.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsCompletionProposalComputer.java
@@ -1,350 +1,350 @@
-/**
- * Copyright (c) 2010, 2012 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.calls.engine;
-
-import static java.lang.Math.rint;
-import static java.util.Collections.emptyList;
-import static org.eclipse.recommenders.utils.Constants.UNKNOWN_METHOD;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.SortedSet;
-
-import org.apache.commons.lang3.StringUtils;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.CompletionProposal;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.internal.codeassist.complete.CompletionOnMemberAccess;
-import org.eclipse.jdt.internal.codeassist.complete.CompletionOnMessageSend;
-import org.eclipse.jdt.internal.codeassist.complete.CompletionOnQualifiedNameReference;
-import org.eclipse.jdt.internal.codeassist.complete.CompletionOnSingleNameReference;
-import org.eclipse.jdt.internal.compiler.ast.ASTNode;
-import org.eclipse.jdt.internal.corext.util.JdtFlags;
-import org.eclipse.jdt.internal.corext.util.SuperTypeHierarchyCache;
-import org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal;
-import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
-import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
-import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer;
-import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContext;
-import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContextFactory;
-import org.eclipse.recommenders.internal.completion.rcp.calls.net.IObjectMethodCallsNet;
-import org.eclipse.recommenders.internal.completion.rcp.calls.preferences.CallPreferencePage;
-import org.eclipse.recommenders.internal.completion.rcp.calls.wiring.CallsCompletionModule.CallCompletion;
-import org.eclipse.recommenders.internal.rcp.models.IModelArchiveStore;
-import org.eclipse.recommenders.internal.utils.codestructs.DefinitionSite.Kind;
-import org.eclipse.recommenders.internal.utils.codestructs.ObjectUsage;
-import org.eclipse.recommenders.internal.utils.codestructs.Variable;
-import org.eclipse.recommenders.rcp.RecommendersPlugin;
-import org.eclipse.recommenders.utils.Tuple;
-import org.eclipse.recommenders.utils.names.IMethodName;
-import org.eclipse.recommenders.utils.names.VmMethodName;
-import org.eclipse.recommenders.utils.rcp.CompletionProposalDecorator;
-import org.eclipse.recommenders.utils.rcp.JavaElementResolver;
-import org.eclipse.recommenders.utils.rcp.JdtUtils;
-import org.eclipse.recommenders.utils.rcp.ast.MethodDeclarationFinder;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-
-public class CallsCompletionProposalComputer implements IJavaCompletionProposalComputer {
-
- public static String CATEGORY_ID = "org.eclipse.recommenders.rcp.category.completion";
-
- @SuppressWarnings("serial")
- private final Set<Class<?>> supportedCompletionRequests = new HashSet<Class<?>>() {
- {
- add(CompletionOnMemberAccess.class);
- add(CompletionOnMessageSend.class);
- add(CompletionOnQualifiedNameReference.class);
- add(CompletionOnSingleNameReference.class);
- }
- };
-
- private final IRecommendersCompletionContextFactory ctxFactory;
- private final JavaElementResolver jdtResolver;
-
- private IRecommendersCompletionContext ctx;
- private String receiverName;
- private IType receiverType;
- @VisibleForTesting
- public ObjectUsage query;
- private IObjectMethodCallsNet model;
- private List<ICompletionProposal> proposals;
- private List<CallsRecommendation> recommendations;
-
- private JavaContentAssistInvocationContext javaContext;
-
- private final IModelArchiveStore<IType, IObjectMethodCallsNet> modelStore;
-
- private final IPreferenceStore prefStore;
-
- @Inject
- public CallsCompletionProposalComputer(final IModelArchiveStore<IType, IObjectMethodCallsNet> modelStore,
- final JavaElementResolver jdtResolver, final IRecommendersCompletionContextFactory ctxFactory,
- @CallCompletion final IPreferenceStore prefStore) {
- this.modelStore = modelStore;
- this.jdtResolver = jdtResolver;
- this.ctxFactory = ctxFactory;
- this.prefStore = prefStore;
- }
-
- @Override
- public List<ICompletionProposal> computeCompletionProposals(final ContentAssistInvocationContext javaContext,
- final IProgressMonitor monitor) {
- initalize(javaContext);
-
- if (!isCompletionRequestSupported()) {
- return emptyList();
- }
- if (!findReceiver()) {
- return emptyList();
- }
- try {
- if (!acquireModel()) {
- return emptyList();
- }
- if (!completeQuery()) {
- return emptyList();
- }
- if (!findRecommendations()) {
- return emptyList();
- }
- createProspsals();
- } finally {
- releaseModel();
- }
- return proposals;
-
- }
-
- private void initalize(final ContentAssistInvocationContext javaContext) {
- this.javaContext = (JavaContentAssistInvocationContext) javaContext;
- ctx = ctxFactory.create(this.javaContext);
- query = ObjectUsage.newObjectUsageWithDefaults();
- proposals = Lists.newLinkedList();
- }
-
- private boolean isCompletionRequestSupported() {
- final ASTNode node = ctx.getCompletionNode().orNull();
- return node == null ? false : supportedCompletionRequests.contains(node.getClass());
- }
-
- private boolean findReceiver() {
- receiverName = ctx.getReceiverName();
- receiverType = ctx.getReceiverType().orNull();
- if (isReceiverNameThis() || isReceiverNameSuper() || isImplicitThis()) {
- // receiver may be this!
- setReceiverToSupertype();
- }
- return receiverType != null;
- }
-
- private boolean isReceiverNameThis() {
- return "this".equals(receiverName);
- }
-
- private boolean isReceiverNameSuper() {
- return "super".equals(receiverName);
- }
-
- private boolean isImplicitThis() {
- return receiverType == null && receiverName.isEmpty();
- }
-
- private void setReceiverToSupertype() {
- try {
- final IMethod m = ctx.getEnclosingMethod().orNull();
- if (m == null || JdtFlags.isStatic(m)) {
- return;
- }
- final IType type = m.getDeclaringType();
- final ITypeHierarchy hierarchy = SuperTypeHierarchyCache.getTypeHierarchy(type);
- receiverType = hierarchy.getSuperclass(type);
- } catch (final Exception e) {
- RecommendersPlugin.logError(e, "Failed to resolve super type of %s", ctx.getEnclosingElement());
- }
- }
-
- private boolean acquireModel() {
- model = modelStore.aquireModel(receiverType).orNull();
- return model != null;
- }
-
- private boolean completeQuery() {
- setCalls();
- setReceiverType();
- setFirstMethodDeclaration();
- setDefinition();
- return true;
- }
-
- private void setDefinition() {
- if (query.definition.equals(UNKNOWN_METHOD)) {
- final Optional<IMethodName> methodDef = ctx.getMethodDef();
- if (methodDef.isPresent()) {
- query.definition = methodDef.get();
- query.kind = Kind.METHOD_RETURN;
- } else if (query.kind == Kind.UNKNOWN) {
- query.kind = Kind.FIELD;
- }
- } else if (query.definition != null && query.kind == Kind.PARAMETER) {
- query.definition = query.contextFirst;
- }
- }
-
- private void setFirstMethodDeclaration() {
- final Optional<IMethod> enclosingMethod = ctx.getEnclosingMethod();
- if (!enclosingMethod.isPresent()) {
- return;
- }
- final IMethod first = JdtUtils.findFirstDeclaration(enclosingMethod.get());
- query.contextFirst = jdtResolver.toRecMethod(first).or(VmMethodName.NULL);
- }
-
- private void setReceiverType() {
- query.type = jdtResolver.toRecType(receiverType);
- }
-
- private void setCalls() {
- final CompilationUnit ast = ctx.getAST();
- final Optional<IMethod> enclosingMethod = ctx.getEnclosingMethod();
- if (enclosingMethod.isPresent()) {
- final IMethod jdtMethod = enclosingMethod.get();
- final IMethodName recMethod = jdtResolver.toRecMethod(jdtMethod).or(VmMethodName.NULL);
- final Optional<MethodDeclaration> astMethod = MethodDeclarationFinder.find(ast, recMethod);
- if (astMethod.isPresent()) {
- final AstBasedObjectUsageResolver r = new AstBasedObjectUsageResolver();
- final ObjectUsage usage = r.findObjectUsage(receiverName, astMethod.get());
- query.calls = usage.calls;
- if (usage.kind != null) {
- query.kind = usage.kind;
- }
- if (usage.definition != null) {
- query.definition = usage.definition;
- final Optional<IMethodName> def = ctx.getMethodDef();
- if (def.isPresent()) {
- query.definition = def.get();
- }
- }
- }
- }
- }
-
- private boolean findRecommendations() {
- recommendations = Lists.newLinkedList();
-
- model.setQuery(query);
-
- final double minProbability = prefStore.getInt(CallPreferencePage.ID_MIN_PROBABILITY) * 0.01;
- final int maxProposals = prefStore.getInt(CallPreferencePage.ID_MAX_PROPOSALS);
- final SortedSet<Tuple<IMethodName, Double>> recommendedMethodCalls = model
- .getRecommendedMethodCalls(minProbability);
-
- final Variable var = Variable.create(receiverName, jdtResolver.toRecType(receiverType), null);
-
- final boolean expectsReturnType = ctx.getExpectedTypeSignature().isPresent();
- final String prefix = ctx.getPrefix();
- for (final Tuple<IMethodName, Double> recommended : recommendedMethodCalls) {
- final IMethodName method = recommended.getFirst();
- final Double probability = recommended.getSecond();
-
- final String proposalPrefix = StringUtils.substring(method.getName(), 0, prefix.length());
- if (!proposalPrefix.equalsIgnoreCase(prefix)) {
- continue;
- }
-
- if (expectsReturnType) {
- if (method.isVoid()) {
- continue;
- }
- }
- final CallsRecommendation recommendation = CallsRecommendation.create(var, method, probability);
- recommendations.add(recommendation);
-
- }
- recommendations = recommendations.subList(0, Math.min(recommendations.size(), maxProposals));
- return !recommendations.isEmpty();
- }
-
- private void createProspsals() {
- final Map<IJavaCompletionProposal, CompletionProposal> proposals = ctx.getProposals();
- for (final Entry<IJavaCompletionProposal, CompletionProposal> p : proposals.entrySet()) {
- final CompletionProposal compilerProposal = p.getValue();
- switch (compilerProposal.getKind()) {
- case CompletionProposal.METHOD_REF:
- case CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER:
- case CompletionProposal.METHOD_NAME_REFERENCE:
- createCallProposalIfRecommended(compilerProposal, p.getKey());
- }
- }
- }
-
- private void createCallProposalIfRecommended(final CompletionProposal compilerProposal,
- final IJavaCompletionProposal jdtuiProposal) {
- final ProposalMatcher matcher = new ProposalMatcher(compilerProposal);
- for (final CallsRecommendation call : recommendations) {
- final IMethodName crMethod = call.method;
- if (!matcher.match(crMethod)) {
- continue;
- }
- // final String recSignature = crMethod.getSignature();
- // if (recSignature.equals(propSignature)) {
- if (jdtuiProposal instanceof AbstractJavaCompletionProposal) {
- int baseRelevance = jdtuiProposal.getRelevance();
- baseRelevance += 250 + (int) rint(call.probability * 100);
- ((AbstractJavaCompletionProposal) jdtuiProposal).setRelevance(baseRelevance);
- }
- final CompletionProposalDecorator decoratedProposal = new CompletionProposalDecorator(jdtuiProposal,
- call.probability);
- proposals.add(decoratedProposal);
- // }
- }
- }
-
- private void releaseModel() {
- if (model != null) {
- modelStore.releaseModel(model);
- model = null;
- }
- }
-
- @Override
- public void sessionStarted() {
- }
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- @Override
- public List computeContextInformation(final ContentAssistInvocationContext context, final IProgressMonitor monitor) {
- return Collections.emptyList();
- }
-
- @Override
- public String getErrorMessage() {
- return null;
- }
-
- @Override
- public void sessionEnded() {
- }
-}
+/**
+ * Copyright (c) 2010, 2012 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.calls.engine;
+
+import static java.lang.Math.rint;
+import static java.util.Collections.emptyList;
+import static org.eclipse.recommenders.utils.Constants.UNKNOWN_METHOD;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.SortedSet;
+
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.CompletionProposal;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.internal.codeassist.complete.CompletionOnMemberAccess;
+import org.eclipse.jdt.internal.codeassist.complete.CompletionOnMessageSend;
+import org.eclipse.jdt.internal.codeassist.complete.CompletionOnQualifiedNameReference;
+import org.eclipse.jdt.internal.codeassist.complete.CompletionOnSingleNameReference;
+import org.eclipse.jdt.internal.compiler.ast.ASTNode;
+import org.eclipse.jdt.internal.corext.util.JdtFlags;
+import org.eclipse.jdt.internal.corext.util.SuperTypeHierarchyCache;
+import org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal;
+import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer;
+import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContext;
+import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContextFactory;
+import org.eclipse.recommenders.internal.completion.rcp.calls.net.IObjectMethodCallsNet;
+import org.eclipse.recommenders.internal.completion.rcp.calls.preferences.CallPreferencePage;
+import org.eclipse.recommenders.internal.completion.rcp.calls.wiring.CallsCompletionModule.CallCompletion;
+import org.eclipse.recommenders.internal.rcp.models.IModelArchiveStore;
+import org.eclipse.recommenders.internal.utils.codestructs.DefinitionSite.Kind;
+import org.eclipse.recommenders.internal.utils.codestructs.ObjectUsage;
+import org.eclipse.recommenders.internal.utils.codestructs.Variable;
+import org.eclipse.recommenders.rcp.RecommendersPlugin;
+import org.eclipse.recommenders.utils.Tuple;
+import org.eclipse.recommenders.utils.names.IMethodName;
+import org.eclipse.recommenders.utils.names.VmMethodName;
+import org.eclipse.recommenders.utils.rcp.CompletionProposalDecorator;
+import org.eclipse.recommenders.utils.rcp.JavaElementResolver;
+import org.eclipse.recommenders.utils.rcp.JdtUtils;
+import org.eclipse.recommenders.utils.rcp.ast.MethodDeclarationFinder;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Optional;
+import com.google.common.collect.Lists;
+import com.google.inject.Inject;
+
+public class CallsCompletionProposalComputer implements IJavaCompletionProposalComputer {
+
+ public static String CATEGORY_ID = "org.eclipse.recommenders.rcp.category.completion";
+
+ @SuppressWarnings("serial")
+ private final Set<Class<?>> supportedCompletionRequests = new HashSet<Class<?>>() {
+ {
+ add(CompletionOnMemberAccess.class);
+ add(CompletionOnMessageSend.class);
+ add(CompletionOnQualifiedNameReference.class);
+ add(CompletionOnSingleNameReference.class);
+ }
+ };
+
+ private final IRecommendersCompletionContextFactory ctxFactory;
+ private final JavaElementResolver jdtResolver;
+
+ private IRecommendersCompletionContext ctx;
+ private String receiverName;
+ private IType receiverType;
+ @VisibleForTesting
+ public ObjectUsage query;
+ private IObjectMethodCallsNet model;
+ private List<ICompletionProposal> proposals;
+ private List<CallsRecommendation> recommendations;
+
+ private JavaContentAssistInvocationContext javaContext;
+
+ private final IModelArchiveStore<IType, IObjectMethodCallsNet> modelStore;
+
+ private final IPreferenceStore prefStore;
+
+ @Inject
+ public CallsCompletionProposalComputer(final IModelArchiveStore<IType, IObjectMethodCallsNet> modelStore,
+ final JavaElementResolver jdtResolver, final IRecommendersCompletionContextFactory ctxFactory,
+ @CallCompletion final IPreferenceStore prefStore) {
+ this.modelStore = modelStore;
+ this.jdtResolver = jdtResolver;
+ this.ctxFactory = ctxFactory;
+ this.prefStore = prefStore;
+ }
+
+ @Override
+ public List<ICompletionProposal> computeCompletionProposals(final ContentAssistInvocationContext javaContext,
+ final IProgressMonitor monitor) {
+ initalize(javaContext);
+
+ if (!isCompletionRequestSupported()) {
+ return emptyList();
+ }
+ if (!findReceiver()) {
+ return emptyList();
+ }
+ try {
+ if (!acquireModel()) {
+ return emptyList();
+ }
+ if (!completeQuery()) {
+ return emptyList();
+ }
+ if (!findRecommendations()) {
+ return emptyList();
+ }
+ createProspsals();
+ } finally {
+ releaseModel();
+ }
+ return proposals;
+
+ }
+
+ private void initalize(final ContentAssistInvocationContext javaContext) {
+ this.javaContext = (JavaContentAssistInvocationContext) javaContext;
+ ctx = ctxFactory.create(this.javaContext);
+ query = ObjectUsage.newObjectUsageWithDefaults();
+ proposals = Lists.newLinkedList();
+ }
+
+ private boolean isCompletionRequestSupported() {
+ final ASTNode node = ctx.getCompletionNode().orNull();
+ return node == null ? false : supportedCompletionRequests.contains(node.getClass());
+ }
+
+ private boolean findReceiver() {
+ receiverName = ctx.getReceiverName();
+ receiverType = ctx.getReceiverType().orNull();
+ if (isReceiverNameThis() || isReceiverNameSuper() || isImplicitThis()) {
+ // receiver may be this!
+ setReceiverToSupertype();
+ }
+ return receiverType != null;
+ }
+
+ private boolean isReceiverNameThis() {
+ return "this".equals(receiverName);
+ }
+
+ private boolean isReceiverNameSuper() {
+ return "super".equals(receiverName);
+ }
+
+ private boolean isImplicitThis() {
+ return receiverType == null && receiverName.isEmpty();
+ }
+
+ private void setReceiverToSupertype() {
+ try {
+ final IMethod m = ctx.getEnclosingMethod().orNull();
+ if (m == null || JdtFlags.isStatic(m)) {
+ return;
+ }
+ final IType type = m.getDeclaringType();
+ final ITypeHierarchy hierarchy = SuperTypeHierarchyCache.getTypeHierarchy(type);
+ receiverType = hierarchy.getSuperclass(type);
+ } catch (final Exception e) {
+ RecommendersPlugin.logError(e, "Failed to resolve super type of %s", ctx.getEnclosingElement());
+ }
+ }
+
+ private boolean acquireModel() {
+ model = modelStore.aquireModel(receiverType).orNull();
+ return model != null;
+ }
+
+ private boolean completeQuery() {
+ setCalls();
+ setReceiverType();
+ setFirstMethodDeclaration();
+ setDefinition();
+ return true;
+ }
+
+ private void setDefinition() {
+ if (query.definition.equals(UNKNOWN_METHOD)) {
+ final Optional<IMethodName> methodDef = ctx.getMethodDef();
+ if (methodDef.isPresent()) {
+ query.definition = methodDef.get();
+ query.kind = Kind.METHOD_RETURN;
+ } else if (query.kind == Kind.UNKNOWN) {
+ query.kind = Kind.FIELD;
+ }
+ } else if (query.definition != null && query.kind == Kind.PARAMETER) {
+ query.definition = query.contextFirst;
+ }
+ }
+
+ private void setFirstMethodDeclaration() {
+ final Optional<IMethod> enclosingMethod = ctx.getEnclosingMethod();
+ if (!enclosingMethod.isPresent()) {
+ return;
+ }
+ final IMethod first = JdtUtils.findFirstDeclaration(enclosingMethod.get());
+ query.contextFirst = jdtResolver.toRecMethod(first).or(VmMethodName.NULL);
+ }
+
+ private void setReceiverType() {
+ query.type = jdtResolver.toRecType(receiverType);
+ }
+
+ private void setCalls() {
+ final CompilationUnit ast = ctx.getAST();
+ final Optional<IMethod> enclosingMethod = ctx.getEnclosingMethod();
+ if (enclosingMethod.isPresent()) {
+ final IMethod jdtMethod = enclosingMethod.get();
+ final IMethodName recMethod = jdtResolver.toRecMethod(jdtMethod).or(VmMethodName.NULL);
+ final Optional<MethodDeclaration> astMethod = MethodDeclarationFinder.find(ast, recMethod);
+ if (astMethod.isPresent()) {
+ final AstBasedObjectUsageResolver r = new AstBasedObjectUsageResolver();
+ final ObjectUsage usage = r.findObjectUsage(receiverName, astMethod.get());
+ query.calls = usage.calls;
+ if (usage.kind != null) {
+ query.kind = usage.kind;
+ }
+ if (usage.definition != null) {
+ query.definition = usage.definition;
+ final Optional<IMethodName> def = ctx.getMethodDef();
+ if (def.isPresent()) {
+ query.definition = def.get();
+ }
+ }
+ }
+ }
+ }
+
+ private boolean findRecommendations() {
+ recommendations = Lists.newLinkedList();
+
+ model.setQuery(query);
+
+ final double minProbability = prefStore.getInt(CallPreferencePage.ID_MIN_PROBABILITY) * 0.01;
+ final int maxProposals = prefStore.getInt(CallPreferencePage.ID_MAX_PROPOSALS);
+ final SortedSet<Tuple<IMethodName, Double>> recommendedMethodCalls = model
+ .getRecommendedMethodCalls(minProbability);
+
+ final Variable var = Variable.create(receiverName, jdtResolver.toRecType(receiverType), null);
+
+ final boolean expectsReturnType = ctx.getExpectedTypeSignature().isPresent();
+ final String prefix = ctx.getPrefix();
+ for (final Tuple<IMethodName, Double> recommended : recommendedMethodCalls) {
+ final IMethodName method = recommended.getFirst();
+ final Double probability = recommended.getSecond();
+
+ final String proposalPrefix = StringUtils.substring(method.getName(), 0, prefix.length());
+ if (!proposalPrefix.equalsIgnoreCase(prefix)) {
+ continue;
+ }
+
+ if (expectsReturnType) {
+ if (method.isVoid()) {
+ continue;
+ }
+ }
+ final CallsRecommendation recommendation = CallsRecommendation.create(var, method, probability);
+ recommendations.add(recommendation);
+
+ }
+ recommendations = recommendations.subList(0, Math.min(recommendations.size(), maxProposals));
+ return !recommendations.isEmpty();
+ }
+
+ private void createProspsals() {
+ final Map<IJavaCompletionProposal, CompletionProposal> proposals = ctx.getProposals();
+ for (final Entry<IJavaCompletionProposal, CompletionProposal> p : proposals.entrySet()) {
+ final CompletionProposal compilerProposal = p.getValue();
+ switch (compilerProposal.getKind()) {
+ case CompletionProposal.METHOD_REF:
+ case CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER:
+ case CompletionProposal.METHOD_NAME_REFERENCE:
+ createCallProposalIfRecommended(compilerProposal, p.getKey());
+ }
+ }
+ }
+
+ private void createCallProposalIfRecommended(final CompletionProposal compilerProposal,
+ final IJavaCompletionProposal jdtuiProposal) {
+ final ProposalMatcher matcher = new ProposalMatcher(compilerProposal);
+ for (final CallsRecommendation call : recommendations) {
+ final IMethodName crMethod = call.method;
+ if (!matcher.match(crMethod)) {
+ continue;
+ }
+ // final String recSignature = crMethod.getSignature();
+ // if (recSignature.equals(propSignature)) {
+ if (jdtuiProposal instanceof AbstractJavaCompletionProposal) {
+ int baseRelevance = jdtuiProposal.getRelevance();
+ baseRelevance += 250 + (int) rint(call.probability * 100);
+ ((AbstractJavaCompletionProposal) jdtuiProposal).setRelevance(baseRelevance);
+ }
+ final CompletionProposalDecorator decoratedProposal = new CompletionProposalDecorator(jdtuiProposal,
+ call.probability);
+ proposals.add(decoratedProposal);
+ // }
+ }
+ }
+
+ private void releaseModel() {
+ if (model != null) {
+ modelStore.releaseModel(model);
+ model = null;
+ }
+ }
+
+ @Override
+ public void sessionStarted() {
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public List computeContextInformation(final ContentAssistInvocationContext context, final IProgressMonitor monitor) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public String getErrorMessage() {
+ return null;
+ }
+
+ @Override
+ public void sessionEnded() {
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsRecommendation.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsRecommendation.java
index 1405e5e..a97df8e 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsRecommendation.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsRecommendation.java
@@ -1,54 +1,54 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.calls.engine;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import org.eclipse.recommenders.internal.utils.codestructs.Variable;
-import org.eclipse.recommenders.rcp.IRecommendation;
-import org.eclipse.recommenders.utils.names.IMethodName;
-
-public class CallsRecommendation implements IRecommendation, Comparable<CallsRecommendation> {
- public Variable local;
-
- public IMethodName method;
-
- public double probability;
-
- public static CallsRecommendation create(final Variable local, final IMethodName recommendedMethodCall,
- final double methodCallProbability) {
- final CallsRecommendation res = new CallsRecommendation();
- res.local = local;
- res.method = recommendedMethodCall;
- res.probability = methodCallProbability;
- return res;
- }
-
- /**
- * Returns the recommendation with the higher probability first. If both compilationUnits2recommendationsIndex have
- * the same probability it returns the recommendation with the lexigraphically lower method name.
- */
- @Override
- public int compareTo(final CallsRecommendation other) {
- final int probabilityCmp = Double.compare(other.probability, probability);
- return probabilityCmp != 0 ? probabilityCmp : method.compareTo(other.method);
- }
-
- @Override
- public double getProbability() {
- return probability;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
- }
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.calls.engine;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.eclipse.recommenders.internal.utils.codestructs.Variable;
+import org.eclipse.recommenders.rcp.IRecommendation;
+import org.eclipse.recommenders.utils.names.IMethodName;
+
+public class CallsRecommendation implements IRecommendation, Comparable<CallsRecommendation> {
+ public Variable local;
+
+ public IMethodName method;
+
+ public double probability;
+
+ public static CallsRecommendation create(final Variable local, final IMethodName recommendedMethodCall,
+ final double methodCallProbability) {
+ final CallsRecommendation res = new CallsRecommendation();
+ res.local = local;
+ res.method = recommendedMethodCall;
+ res.probability = methodCallProbability;
+ return res;
+ }
+
+ /**
+ * Returns the recommendation with the higher probability first. If both compilationUnits2recommendationsIndex have
+ * the same probability it returns the recommendation with the lexigraphically lower method name.
+ */
+ @Override
+ public int compareTo(final CallsRecommendation other) {
+ final int probabilityCmp = Double.compare(other.probability, probability);
+ return probabilityCmp != 0 ? probabilityCmp : method.compareTo(other.method);
+ }
+
+ @Override
+ public double getProbability() {
+ return probability;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsSessionProcessor.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsSessionProcessor.java
index 6fce29e..7430969 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsSessionProcessor.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/engine/CallsSessionProcessor.java
@@ -1,276 +1,276 @@
-/**
- * Copyright (c) 2010, 2012 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.calls.engine;
-
-import static java.lang.Math.rint;
-import static org.eclipse.recommenders.internal.completion.rcp.ProcessableCompletionProposalComputer.NULL_PROPOSAL;
-import static org.eclipse.recommenders.utils.Constants.UNKNOWN_METHOD;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.SortedSet;
-
-import org.eclipse.jdt.core.CompletionProposal;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.internal.codeassist.complete.CompletionOnMemberAccess;
-import org.eclipse.jdt.internal.codeassist.complete.CompletionOnMessageSend;
-import org.eclipse.jdt.internal.codeassist.complete.CompletionOnQualifiedNameReference;
-import org.eclipse.jdt.internal.codeassist.complete.CompletionOnSingleNameReference;
-import org.eclipse.jdt.internal.compiler.ast.ASTNode;
-import org.eclipse.jdt.internal.corext.util.JdtFlags;
-import org.eclipse.jdt.internal.corext.util.SuperTypeHierarchyCache;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.recommenders.completion.rcp.IProcessableProposal;
-import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContext;
-import org.eclipse.recommenders.completion.rcp.SessionProcessor;
-import org.eclipse.recommenders.internal.completion.rcp.SimpleProposalProcessor;
-import org.eclipse.recommenders.internal.completion.rcp.calls.net.IObjectMethodCallsNet;
-import org.eclipse.recommenders.internal.completion.rcp.calls.preferences.CallPreferencePage;
-import org.eclipse.recommenders.internal.completion.rcp.calls.wiring.CallsCompletionModule.CallCompletion;
-import org.eclipse.recommenders.internal.rcp.models.IModelArchiveStore;
-import org.eclipse.recommenders.internal.utils.codestructs.DefinitionSite.Kind;
-import org.eclipse.recommenders.internal.utils.codestructs.ObjectUsage;
-import org.eclipse.recommenders.internal.utils.codestructs.Variable;
-import org.eclipse.recommenders.rcp.RecommendersPlugin;
-import org.eclipse.recommenders.utils.Tuple;
-import org.eclipse.recommenders.utils.names.IMethodName;
-import org.eclipse.recommenders.utils.names.VmMethodName;
-import org.eclipse.recommenders.utils.rcp.JavaElementResolver;
-import org.eclipse.recommenders.utils.rcp.JdtUtils;
-import org.eclipse.recommenders.utils.rcp.ast.MethodDeclarationFinder;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-
-// TODO factor the recommender interface out of the completion engine
-public class CallsSessionProcessor extends SessionProcessor {
-
- @SuppressWarnings("serial")
- private final Set<Class<?>> supportedCompletionRequests = new HashSet<Class<?>>() {
- {
- add(CompletionOnMemberAccess.class);
- add(CompletionOnMessageSend.class);
- add(CompletionOnQualifiedNameReference.class);
- add(CompletionOnSingleNameReference.class);
- }
- };
-
- private final JavaElementResolver jdtResolver;
-
- private IRecommendersCompletionContext ctx;
- private String receiverName;
- private IType receiverType;
- @VisibleForTesting
- public ObjectUsage query;
- private IObjectMethodCallsNet model;
- private List<CallsRecommendation> recommendations;
-
- private final IModelArchiveStore<IType, IObjectMethodCallsNet> modelStore;
-
- private final IPreferenceStore prefStore;
-
- @Inject
- public CallsSessionProcessor(final IModelArchiveStore<IType, IObjectMethodCallsNet> modelStore,
- final JavaElementResolver jdtResolver, @CallCompletion final IPreferenceStore prefStore) {
- this.modelStore = modelStore;
- this.jdtResolver = jdtResolver;
- this.prefStore = prefStore;
- }
-
- @Override
- public void startSession(IRecommendersCompletionContext context) {
- ctx = context;
- query = ObjectUsage.newObjectUsageWithDefaults();
- recommendations = Lists.newLinkedList();
-
- try {
- if (!isCompletionRequestSupported() || //
- !findReceiver() || //
- !acquireModel() || //
- !completeQuery() || //
- !findRecommendations()) {
- return;
- }
- } finally {
- releaseModel();
- }
- }
-
- private boolean isCompletionRequestSupported() {
- final ASTNode node = ctx.getCompletionNode().orNull();
- return node == null ? false : supportedCompletionRequests.contains(node.getClass());
- }
-
- private boolean findReceiver() {
- receiverName = ctx.getReceiverName();
- receiverType = ctx.getReceiverType().orNull();
- if (isReceiverNameThis() || isReceiverNameSuper() || isImplicitThis()) {
- receiverName = "";
- // receiver may be this!
- setReceiverToSupertype();
- }
- return receiverType != null;
- }
-
- private boolean isReceiverNameThis() {
- return "this".equals(receiverName);
- }
-
- private boolean isReceiverNameSuper() {
- return "super".equals(receiverName);
- }
-
- private boolean isImplicitThis() {
- return receiverType == null;// && receiverName.isEmpty();
- }
-
- private void setReceiverToSupertype() {
- try {
- final IMethod m = ctx.getEnclosingMethod().orNull();
- if (m == null || JdtFlags.isStatic(m)) {
- return;
- }
- final IType type = m.getDeclaringType();
- final ITypeHierarchy hierarchy = SuperTypeHierarchyCache.getTypeHierarchy(type);
- receiverType = hierarchy.getSuperclass(type);
- } catch (final Exception e) {
- RecommendersPlugin.logError(e, "Failed to resolve super type of %s", ctx.getEnclosingElement());
- }
- }
-
- private boolean acquireModel() {
- model = modelStore.aquireModel(receiverType).orNull();
- return model != null;
- }
-
- private boolean completeQuery() {
- setCalls();
- setReceiverType();
- setFirstMethodDeclaration();
- setDefinition();
- return true;
- }
-
- private void setDefinition() {
- if (query.definition.equals(UNKNOWN_METHOD)) {
- final Optional<IMethodName> methodDef = ctx.getMethodDef();
- if (methodDef.isPresent()) {
- query.definition = methodDef.get();
- query.kind = Kind.METHOD_RETURN;
- } else if (query.kind == Kind.UNKNOWN) {
- query.kind = Kind.FIELD;
- }
- } else if (query.definition != null && query.kind == Kind.PARAMETER) {
- query.definition = query.contextFirst;
- }
- }
-
- private void setFirstMethodDeclaration() {
- final Optional<IMethod> enclosingMethod = ctx.getEnclosingMethod();
- if (!enclosingMethod.isPresent()) {
- return;
- }
- final IMethod first = JdtUtils.findFirstDeclaration(enclosingMethod.get());
- query.contextFirst = jdtResolver.toRecMethod(first).or(VmMethodName.NULL);
- }
-
- private void setReceiverType() {
- query.type = jdtResolver.toRecType(receiverType);
- }
-
- private void setCalls() {
- final CompilationUnit ast = ctx.getAST();
- final Optional<IMethod> enclosingMethod = ctx.getEnclosingMethod();
- if (enclosingMethod.isPresent()) {
- final IMethod jdtMethod = enclosingMethod.get();
- final IMethodName recMethod = jdtResolver.toRecMethod(jdtMethod).or(VmMethodName.NULL);
- final Optional<MethodDeclaration> astMethod = MethodDeclarationFinder.find(ast, recMethod);
- if (astMethod.isPresent()) {
- final AstBasedObjectUsageResolver r = new AstBasedObjectUsageResolver();
- final ObjectUsage usage = r.findObjectUsage(receiverName, astMethod.get());
- query.calls = usage.calls;
- if (usage.kind != null) {
- query.kind = usage.kind;
- }
- if (usage.definition != null) {
- query.definition = usage.definition;
- final Optional<IMethodName> def = ctx.getMethodDef();
- if (def.isPresent()) {
- query.definition = def.get();
- }
- }
- }
- }
- }
-
- private boolean findRecommendations() {
-
- model.setQuery(query);
-
- final double minProbability = prefStore.getInt(CallPreferencePage.ID_MIN_PROBABILITY) * 0.01;
- final int maxProposals = prefStore.getInt(CallPreferencePage.ID_MAX_PROPOSALS);
- final SortedSet<Tuple<IMethodName, Double>> recommendedMethodCalls =
- model.getRecommendedMethodCalls(minProbability);
-
- final Variable var = Variable.create(receiverName, jdtResolver.toRecType(receiverType), null);
-
- final boolean expectsReturnType = ctx.getExpectedTypeSignature().isPresent();
- for (final Tuple<IMethodName, Double> recommended : recommendedMethodCalls) {
- final IMethodName method = recommended.getFirst();
- final Double probability = recommended.getSecond();
-
- if (expectsReturnType) {
- if (method.isVoid()) {
- continue;
- }
- }
- final CallsRecommendation recommendation = CallsRecommendation.create(var, method, probability);
- recommendations.add(recommendation);
-
- }
- recommendations = recommendations.subList(0, Math.min(recommendations.size(), maxProposals));
- return !recommendations.isEmpty();
- }
-
- private void releaseModel() {
- if (model != null) {
- modelStore.releaseModel(model);
- model = null;
- }
- }
-
- @Override
- public void process(IProcessableProposal proposal) {
- final CompletionProposal coreProposal = proposal.getCoreProposal().or(NULL_PROPOSAL);
- switch (coreProposal.getKind()) {
- case CompletionProposal.METHOD_REF:
- case CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER:
- case CompletionProposal.METHOD_NAME_REFERENCE:
- final ProposalMatcher matcher = new ProposalMatcher(coreProposal);
- for (final CallsRecommendation call : recommendations) {
- final IMethodName crMethod = call.method;
- if (!matcher.match(crMethod)) continue;
-
- final int percentage = (int) rint(call.probability * 100);
- int increment = 200 + percentage;
- String label = percentage + " %";
- proposal.getProposalProcessorManager().addProcessor(new SimpleProposalProcessor(increment, label));
- }
- }
- }
-}
+/**
+ * Copyright (c) 2010, 2012 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.calls.engine;
+
+import static java.lang.Math.rint;
+import static org.eclipse.recommenders.internal.completion.rcp.ProcessableCompletionProposalComputer.NULL_PROPOSAL;
+import static org.eclipse.recommenders.utils.Constants.UNKNOWN_METHOD;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedSet;
+
+import org.eclipse.jdt.core.CompletionProposal;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.internal.codeassist.complete.CompletionOnMemberAccess;
+import org.eclipse.jdt.internal.codeassist.complete.CompletionOnMessageSend;
+import org.eclipse.jdt.internal.codeassist.complete.CompletionOnQualifiedNameReference;
+import org.eclipse.jdt.internal.codeassist.complete.CompletionOnSingleNameReference;
+import org.eclipse.jdt.internal.compiler.ast.ASTNode;
+import org.eclipse.jdt.internal.corext.util.JdtFlags;
+import org.eclipse.jdt.internal.corext.util.SuperTypeHierarchyCache;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.recommenders.completion.rcp.IProcessableProposal;
+import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContext;
+import org.eclipse.recommenders.completion.rcp.SessionProcessor;
+import org.eclipse.recommenders.internal.completion.rcp.SimpleProposalProcessor;
+import org.eclipse.recommenders.internal.completion.rcp.calls.net.IObjectMethodCallsNet;
+import org.eclipse.recommenders.internal.completion.rcp.calls.preferences.CallPreferencePage;
+import org.eclipse.recommenders.internal.completion.rcp.calls.wiring.CallsCompletionModule.CallCompletion;
+import org.eclipse.recommenders.internal.rcp.models.IModelArchiveStore;
+import org.eclipse.recommenders.internal.utils.codestructs.DefinitionSite.Kind;
+import org.eclipse.recommenders.internal.utils.codestructs.ObjectUsage;
+import org.eclipse.recommenders.internal.utils.codestructs.Variable;
+import org.eclipse.recommenders.rcp.RecommendersPlugin;
+import org.eclipse.recommenders.utils.Tuple;
+import org.eclipse.recommenders.utils.names.IMethodName;
+import org.eclipse.recommenders.utils.names.VmMethodName;
+import org.eclipse.recommenders.utils.rcp.JavaElementResolver;
+import org.eclipse.recommenders.utils.rcp.JdtUtils;
+import org.eclipse.recommenders.utils.rcp.ast.MethodDeclarationFinder;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Optional;
+import com.google.common.collect.Lists;
+import com.google.inject.Inject;
+
+// TODO factor the recommender interface out of the completion engine
+public class CallsSessionProcessor extends SessionProcessor {
+
+ @SuppressWarnings("serial")
+ private final Set<Class<?>> supportedCompletionRequests = new HashSet<Class<?>>() {
+ {
+ add(CompletionOnMemberAccess.class);
+ add(CompletionOnMessageSend.class);
+ add(CompletionOnQualifiedNameReference.class);
+ add(CompletionOnSingleNameReference.class);
+ }
+ };
+
+ private final JavaElementResolver jdtResolver;
+
+ private IRecommendersCompletionContext ctx;
+ private String receiverName;
+ private IType receiverType;
+ @VisibleForTesting
+ public ObjectUsage query;
+ private IObjectMethodCallsNet model;
+ private List<CallsRecommendation> recommendations;
+
+ private final IModelArchiveStore<IType, IObjectMethodCallsNet> modelStore;
+
+ private final IPreferenceStore prefStore;
+
+ @Inject
+ public CallsSessionProcessor(final IModelArchiveStore<IType, IObjectMethodCallsNet> modelStore,
+ final JavaElementResolver jdtResolver, @CallCompletion final IPreferenceStore prefStore) {
+ this.modelStore = modelStore;
+ this.jdtResolver = jdtResolver;
+ this.prefStore = prefStore;
+ }
+
+ @Override
+ public void startSession(IRecommendersCompletionContext context) {
+ ctx = context;
+ query = ObjectUsage.newObjectUsageWithDefaults();
+ recommendations = Lists.newLinkedList();
+
+ try {
+ if (!isCompletionRequestSupported() || //
+ !findReceiver() || //
+ !acquireModel() || //
+ !completeQuery() || //
+ !findRecommendations()) {
+ return;
+ }
+ } finally {
+ releaseModel();
+ }
+ }
+
+ private boolean isCompletionRequestSupported() {
+ final ASTNode node = ctx.getCompletionNode().orNull();
+ return node == null ? false : supportedCompletionRequests.contains(node.getClass());
+ }
+
+ private boolean findReceiver() {
+ receiverName = ctx.getReceiverName();
+ receiverType = ctx.getReceiverType().orNull();
+ if (isReceiverNameThis() || isReceiverNameSuper() || isImplicitThis()) {
+ receiverName = "";
+ // receiver may be this!
+ setReceiverToSupertype();
+ }
+ return receiverType != null;
+ }
+
+ private boolean isReceiverNameThis() {
+ return "this".equals(receiverName);
+ }
+
+ private boolean isReceiverNameSuper() {
+ return "super".equals(receiverName);
+ }
+
+ private boolean isImplicitThis() {
+ return receiverType == null;// && receiverName.isEmpty();
+ }
+
+ private void setReceiverToSupertype() {
+ try {
+ final IMethod m = ctx.getEnclosingMethod().orNull();
+ if (m == null || JdtFlags.isStatic(m)) {
+ return;
+ }
+ final IType type = m.getDeclaringType();
+ final ITypeHierarchy hierarchy = SuperTypeHierarchyCache.getTypeHierarchy(type);
+ receiverType = hierarchy.getSuperclass(type);
+ } catch (final Exception e) {
+ RecommendersPlugin.logError(e, "Failed to resolve super type of %s", ctx.getEnclosingElement());
+ }
+ }
+
+ private boolean acquireModel() {
+ model = modelStore.aquireModel(receiverType).orNull();
+ return model != null;
+ }
+
+ private boolean completeQuery() {
+ setCalls();
+ setReceiverType();
+ setFirstMethodDeclaration();
+ setDefinition();
+ return true;
+ }
+
+ private void setDefinition() {
+ if (query.definition.equals(UNKNOWN_METHOD)) {
+ final Optional<IMethodName> methodDef = ctx.getMethodDef();
+ if (methodDef.isPresent()) {
+ query.definition = methodDef.get();
+ query.kind = Kind.METHOD_RETURN;
+ } else if (query.kind == Kind.UNKNOWN) {
+ query.kind = Kind.FIELD;
+ }
+ } else if (query.definition != null && query.kind == Kind.PARAMETER) {
+ query.definition = query.contextFirst;
+ }
+ }
+
+ private void setFirstMethodDeclaration() {
+ final Optional<IMethod> enclosingMethod = ctx.getEnclosingMethod();
+ if (!enclosingMethod.isPresent()) {
+ return;
+ }
+ final IMethod first = JdtUtils.findFirstDeclaration(enclosingMethod.get());
+ query.contextFirst = jdtResolver.toRecMethod(first).or(VmMethodName.NULL);
+ }
+
+ private void setReceiverType() {
+ query.type = jdtResolver.toRecType(receiverType);
+ }
+
+ private void setCalls() {
+ final CompilationUnit ast = ctx.getAST();
+ final Optional<IMethod> enclosingMethod = ctx.getEnclosingMethod();
+ if (enclosingMethod.isPresent()) {
+ final IMethod jdtMethod = enclosingMethod.get();
+ final IMethodName recMethod = jdtResolver.toRecMethod(jdtMethod).or(VmMethodName.NULL);
+ final Optional<MethodDeclaration> astMethod = MethodDeclarationFinder.find(ast, recMethod);
+ if (astMethod.isPresent()) {
+ final AstBasedObjectUsageResolver r = new AstBasedObjectUsageResolver();
+ final ObjectUsage usage = r.findObjectUsage(receiverName, astMethod.get());
+ query.calls = usage.calls;
+ if (usage.kind != null) {
+ query.kind = usage.kind;
+ }
+ if (usage.definition != null) {
+ query.definition = usage.definition;
+ final Optional<IMethodName> def = ctx.getMethodDef();
+ if (def.isPresent()) {
+ query.definition = def.get();
+ }
+ }
+ }
+ }
+ }
+
+ private boolean findRecommendations() {
+
+ model.setQuery(query);
+
+ final double minProbability = prefStore.getInt(CallPreferencePage.ID_MIN_PROBABILITY) * 0.01;
+ final int maxProposals = prefStore.getInt(CallPreferencePage.ID_MAX_PROPOSALS);
+ final SortedSet<Tuple<IMethodName, Double>> recommendedMethodCalls =
+ model.getRecommendedMethodCalls(minProbability);
+
+ final Variable var = Variable.create(receiverName, jdtResolver.toRecType(receiverType), null);
+
+ final boolean expectsReturnType = ctx.getExpectedTypeSignature().isPresent();
+ for (final Tuple<IMethodName, Double> recommended : recommendedMethodCalls) {
+ final IMethodName method = recommended.getFirst();
+ final Double probability = recommended.getSecond();
+
+ if (expectsReturnType) {
+ if (method.isVoid()) {
+ continue;
+ }
+ }
+ final CallsRecommendation recommendation = CallsRecommendation.create(var, method, probability);
+ recommendations.add(recommendation);
+
+ }
+ recommendations = recommendations.subList(0, Math.min(recommendations.size(), maxProposals));
+ return !recommendations.isEmpty();
+ }
+
+ private void releaseModel() {
+ if (model != null) {
+ modelStore.releaseModel(model);
+ model = null;
+ }
+ }
+
+ @Override
+ public void process(IProcessableProposal proposal) {
+ final CompletionProposal coreProposal = proposal.getCoreProposal().or(NULL_PROPOSAL);
+ switch (coreProposal.getKind()) {
+ case CompletionProposal.METHOD_REF:
+ case CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER:
+ case CompletionProposal.METHOD_NAME_REFERENCE:
+ final ProposalMatcher matcher = new ProposalMatcher(coreProposal);
+ for (final CallsRecommendation call : recommendations) {
+ final IMethodName crMethod = call.method;
+ if (!matcher.match(crMethod)) continue;
+
+ final int percentage = (int) rint(call.probability * 100);
+ int increment = 200 + percentage;
+ String label = percentage + " %";
+ proposal.getProposalProcessorManager().addProcessor(new SimpleProposalProcessor(increment, label));
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/net/BayesNetWrapper.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/net/BayesNetWrapper.java
index 87cd88c..641f461 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/net/BayesNetWrapper.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/net/BayesNetWrapper.java
@@ -1,392 +1,392 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Johannes Lerch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.calls.net;
-
-import static org.eclipse.recommenders.utils.Checks.ensureEquals;
-import static org.eclipse.recommenders.utils.Constants.N_NODEID_CALL_GROUPS;
-import static org.eclipse.recommenders.utils.Constants.N_NODEID_CONTEXT;
-import static org.eclipse.recommenders.utils.Constants.N_NODEID_DEF;
-import static org.eclipse.recommenders.utils.Constants.N_NODEID_DEF_KIND;
-import static org.eclipse.recommenders.utils.Constants.N_STATE_DUMMY_DEF;
-import static org.eclipse.recommenders.utils.Constants.N_STATE_FALSE;
-import static org.eclipse.recommenders.utils.Constants.N_STATE_TRUE;
-import static org.eclipse.recommenders.utils.Constants.UNKNOWN_METHOD;
-
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.eclipse.recommenders.commons.bayesnet.BayesianNetwork;
-import org.eclipse.recommenders.commons.bayesnet.Node;
-import org.eclipse.recommenders.internal.utils.codestructs.DefinitionSite;
-import org.eclipse.recommenders.internal.utils.codestructs.DefinitionSite.Kind;
-import org.eclipse.recommenders.internal.utils.codestructs.ObjectUsage;
-import org.eclipse.recommenders.jayes.BayesNet;
-import org.eclipse.recommenders.jayes.BayesNode;
-import org.eclipse.recommenders.jayes.inference.junctionTree.JunctionTreeAlgorithm;
-import org.eclipse.recommenders.utils.Constants;
-import org.eclipse.recommenders.utils.Tuple;
-import org.eclipse.recommenders.utils.names.IFieldName;
-import org.eclipse.recommenders.utils.names.IMethodName;
-import org.eclipse.recommenders.utils.names.ITypeName;
-import org.eclipse.recommenders.utils.names.VmMethodName;
-
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-/**
- * Expected structure:
- *
- * <ul>
- * <li>every node must have at least <b>2 states</b>!
- * <li>the first state is supposed to be a dummy state. Call it like {@link Constants#N_STATE_DUMMY_CTX}
- * <li>the second state <b>may</b> to be a dummy state too if no valuable other state could be found.
- * </ul>
- *
- * <ul>
- * <li><b>callgroup node (formerly called pattern node):</b>
- * <ul>
- * <li>node name: {@link Constants#N_NODEID_CALL_GROUPS}
- * <li>state names: no constraints. recommended schema is to use 'p'#someNumber.
- * </ul>
- * <li><b>context node:</b>
- * <ul>
- * <li>node name: {@link Constants#N_NODEID_CONTEXT}
- * <li>state names: fully-qualified method names as returned by {@link IMethodName#getIdentifier()}.
- * </ul>
- * <li><b>definition node:</b>
- * <ul>
- * <li>node name: {@link Constants#N_NODEID_DEF}
- * <li>state names: fully-qualified names as returned by {@link IMethodName#getIdentifier()} or
- * {@link IFieldName#getIdentifier()}.
- * </ul>
- * <li><b>definition kind node:</b>
- * <ul>
- * <li>node name: {@link Constants#N_NODEID_DEF_KIND}
- * <li>state names: one of {@link DefinitionSite.Kind}, i.e., METHOD_RETURN, NEW, FIELD, PARAMETER, THIS, UNKNOWN, or
- * ANY
- * </ul>
- * <li><b>method call node:</b>
- * <ul>
- * <li>node name: {@link IMethodName#getIdentifier()}
- * <li>state names: {@link Constants#N_STATE_TRUE} or {@link Constants#N_STATE_FALSE}
- * </ul>
- * </ul>
- */
-
-public class BayesNetWrapper implements IObjectMethodCallsNet {
-
- private final ITypeName typeName;
-
- private JunctionTreeAlgorithm junctionTreeAlgorithm;
-
- private BayesNet bayesNet;
- private BayesNode callgroupNode;
- private BayesNode contextNode;
- private BayesNode kindNode;
- private BayesNode definitionNode;
- private final HashMap<IMethodName, BayesNode> callNodes;
-
- public BayesNetWrapper(final ITypeName name, final BayesianNetwork network) {
- this.typeName = name;
- callNodes = new HashMap<IMethodName, BayesNode>();
- initializeNetwork(network);
- }
-
- private void initializeNetwork(final BayesianNetwork network) {
- bayesNet = new BayesNet();
- initializeNodes(network);
- initializeArcs(network);
- initializeProbabilities(network);
-
- junctionTreeAlgorithm = new JunctionTreeAlgorithm();
- junctionTreeAlgorithm.setNetwork(bayesNet);
- }
-
- private void initializeNodes(final BayesianNetwork network) {
- final Collection<Node> nodes = network.getNodes();
- for (final Node node : nodes) {
- final BayesNode bayesNode = new BayesNode(node.getIdentifier());
- final String[] states = node.getStates();
- for (int i = 0; i < states.length; i++) {
- bayesNode.addOutcome(states[i]);
- }
- bayesNet.addNode(bayesNode);
-
- if (node.getIdentifier().equals(N_NODEID_CONTEXT)) {
- contextNode = bayesNode;
- } else if (node.getIdentifier().equals(N_NODEID_CALL_GROUPS)) {
- callgroupNode = bayesNode;
- } else if (node.getIdentifier().equals(N_NODEID_DEF_KIND)) {
- kindNode = bayesNode;
- } else if (node.getIdentifier().equals(N_NODEID_DEF)) {
- definitionNode = bayesNode;
- } else {
- final VmMethodName vmMethodName = VmMethodName.get(node.getIdentifier());
- callNodes.put(vmMethodName, bayesNode);
- }
- }
- }
-
- private void initializeArcs(final BayesianNetwork network) {
- final Collection<Node> nodes = network.getNodes();
- for (final Node node : nodes) {
- final Node[] parents = node.getParents();
- final BayesNode children = bayesNet.getNode(node.getIdentifier());
- final LinkedList<BayesNode> bnParents = new LinkedList<BayesNode>();
- for (int i = 0; i < parents.length; i++) {
- bnParents.add(bayesNet.getNode(parents[i].getIdentifier()));
- }
- children.setParents(bnParents);
- }
- }
-
- private void initializeProbabilities(final BayesianNetwork network) {
- final Collection<Node> nodes = network.getNodes();
- for (final Node node : nodes) {
- final BayesNode bayesNode = bayesNet.getNode(node.getIdentifier());
- bayesNode.setProbabilities(node.getProbabilities());
- }
- }
-
- @Override
- public ITypeName getType() {
- return typeName;
- }
-
- @Override
- public void clearEvidence() {
- junctionTreeAlgorithm.setEvidence(new HashMap<BayesNode, String>());
- }
-
- @Override
- public void setMethodContext(final IMethodName newActiveMethodContext) {
- final String identifier;
- if (newActiveMethodContext == null) {
- identifier = UNKNOWN_METHOD.getIdentifier();
- } else {
- identifier = newActiveMethodContext.getIdentifier();
- }
-
- if (contextNode.getOutcomes().contains(identifier)) {
- junctionTreeAlgorithm.addEvidence(contextNode, identifier);
- }
- }
-
- @Override
- public void setKind(final DefinitionSite.Kind newKind) {
- if (newKind == null) {
- clearEvidence();
- return;
- }
- final String identifier = newKind.toString();
- if (kindNode.getOutcomes().contains(identifier)) {
- junctionTreeAlgorithm.addEvidence(kindNode, identifier);
- }
- }
-
- @Override
- public void setDefinition(final IMethodName newDefinition) {
- final String identifier = newDefinition == null ? N_STATE_DUMMY_DEF : newDefinition.getIdentifier();
- if (definitionNode.getOutcomes().contains(identifier)) {
- junctionTreeAlgorithm.addEvidence(definitionNode, identifier);
- }
- }
-
- @Override
- public void setObservedMethodCalls(final ITypeName rebaseType, final Set<IMethodName> invokedMethods) {
- for (final IMethodName invokedMethod : invokedMethods) {
- final IMethodName rebased = rebaseType == null ? invokedMethod : VmMethodName.rebase(rebaseType,
- invokedMethod);
- setCalled(rebased);
- }
-
- if (rebaseType != null) {
- final IMethodName no = VmMethodName.rebase(rebaseType, Constants.NO_METHOD);
- setCalled(no, N_STATE_FALSE);
- }
- }
-
- @Override
- public void setQuery(final ObjectUsage query) {
- clearEvidence();
- setMethodContext(query.contextFirst);
- setKind(query.kind);
- if (query.definition != null && !query.definition.equals(UNKNOWN_METHOD))
- setDefinition(query.definition);
- setObservedMethodCalls(query.type, query.calls);
- }
-
- @Override
- public void setCalled(final IMethodName calledMethod) {
- setCalled(calledMethod, N_STATE_TRUE);
- }
-
- public void setCalled(final IMethodName calledMethod, String state) {
- final BayesNode node = bayesNet.getNode(calledMethod.getIdentifier());
- if (node != null) {
- junctionTreeAlgorithm.addEvidence(node, state);
- }
- }
-
- @Override
- public SortedSet<Tuple<IMethodName, Double>> getRecommendedMethodCalls(final double minProbabilityThreshold) {
-
- final TreeSet<Tuple<IMethodName, Double>> res = createSortedSet();
-
- for (final IMethodName method : callNodes.keySet()) {
- final BayesNode bayesNode = callNodes.get(method);
- final boolean isAlreadyUsedAsEvidence = junctionTreeAlgorithm.getEvidence().containsKey(bayesNode);
- if (!isAlreadyUsedAsEvidence) {
- final int indexForTrue = bayesNode.getOutcomeIndex(N_STATE_TRUE);
- final double[] probabilities = junctionTreeAlgorithm.getBeliefs(bayesNode);
- final double probability = probabilities[indexForTrue];
- if (probability >= minProbabilityThreshold) {
- res.add(Tuple.newTuple(method, probability));
- }
- }
- }
-
- return res;
- }
-
- private TreeSet<Tuple<IMethodName, Double>> createSortedSet() {
- final TreeSet<Tuple<IMethodName, Double>> res = Sets.newTreeSet(new Comparator<Tuple<IMethodName, Double>>() {
-
- @Override
- public int compare(final Tuple<IMethodName, Double> o1, final Tuple<IMethodName, Double> o2) {
- // the higher probability will be sorted above the lower values:
- final int probabilityCompare = Double.compare(o2.getSecond(), o1.getSecond());
- return probabilityCompare != 0 ? probabilityCompare : o1.getFirst().compareTo(o2.getFirst());
- }
- });
- return res;
- }
-
- @Override
- public SortedSet<Tuple<IMethodName, Double>> getRecommendedMethodCalls(final double minProbabilityThreshold,
- final int maxNumberOfRecommendations) {
- final SortedSet<Tuple<IMethodName, Double>> recommendations = getRecommendedMethodCalls(minProbabilityThreshold);
- if (recommendations.size() <= maxNumberOfRecommendations) {
- return recommendations;
- }
- // need to remove smaller items:
- final Tuple<IMethodName, Double> firstExcludedRecommendation = Iterables.get(recommendations,
- maxNumberOfRecommendations);
- final SortedSet<Tuple<IMethodName, Double>> res = recommendations.headSet(firstExcludedRecommendation);
- ensureEquals(res.size(), maxNumberOfRecommendations,
- "filter op did not return expected number of compilationUnits2recommendationsIndex");
- return res;
- }
-
- @Override
- public List<Tuple<String, Double>> getPatternsWithProbability() {
- final double[] probs = junctionTreeAlgorithm.getBeliefs(callgroupNode);
- final List<Tuple<String, Double>> res = Lists.newArrayListWithCapacity(probs.length);
- final Set<String> outcomes = callgroupNode.getOutcomes();
- for (final String outcome : outcomes) {
- final int probIndex = callgroupNode.getOutcomeIndex(outcome);
- final double p = probs[probIndex];
- if (0.01 > p) {
- continue;
- }
- res.add(Tuple.newTuple(outcome, p));
- }
- return res;
- }
-
- @Override
- public void setPattern(final String patternName) {
- junctionTreeAlgorithm.addEvidence(callgroupNode, patternName);
- }
-
- @Override
- public Collection<IMethodName> getMethodCalls() {
- return new LinkedList<IMethodName>(callNodes.keySet());
- }
-
- @Override
- public Collection<IMethodName> getContexts() {
- final Set<String> outcomes = contextNode.getOutcomes();
- final LinkedList<IMethodName> result = new LinkedList<IMethodName>();
- for (final String outcome : outcomes) {
- result.add(VmMethodName.get(outcome));
- }
- return result;
- }
-
- @Override
- public IMethodName getActiveContext() {
- return computeMethodNameFromState(contextNode);
- }
-
- private IMethodName computeMethodNameFromState(final BayesNode node) {
- final String stateId = junctionTreeAlgorithm.getEvidence().get(node);
- if (stateId == null) {
- return VmMethodName.NULL;
- }
- return VmMethodName.get(stateId);
- }
-
- @Override
- public IMethodName getActiveDefinition() {
- return computeMethodNameFromState(definitionNode);
- }
-
- @Override
- public Kind getActiveKind() {
- final String stateId = junctionTreeAlgorithm.getEvidence().get(kindNode);
- if (stateId == null) {
- return Kind.UNKNOWN;
- }
- return Kind.valueOf(stateId);
- }
-
- @Override
- public Set<IMethodName> getActiveCalls() {
- final TreeSet<IMethodName> res = Sets.newTreeSet();
- final Map<BayesNode, String> evidence = junctionTreeAlgorithm.getEvidence();
- for (final BayesNode methodNode : callNodes.values()) {
- if (evidence.containsKey(methodNode) && evidence.get(methodNode).equals(Constants.N_STATE_TRUE)) {
- res.add(VmMethodName.get(methodNode.getName()));
- }
- }
- // remove the NULL that may have been introduced by res.add(compute...)
- res.remove(VmMethodName.NULL);
- return res;
- }
-
- @Override
- public Set<Tuple<String, Double>> getDefinitions() {
- Set<Tuple<String, Double>> res = Sets.newHashSet();
- double[] beliefs = junctionTreeAlgorithm.getBeliefs(definitionNode);
- for (int i = definitionNode.getOutcomeCount(); i-- > 0;) {
- if (beliefs[i] > 0.05) {
- String outcomeName = definitionNode.getOutcomeName(i);
- if (outcomeName.equals("LNone.none()V")) {
- continue;
- }
- if (outcomeName.equals(UNKNOWN_METHOD.getIdentifier())) {
- continue;
- }
- res.add(Tuple.newTuple(outcomeName, beliefs[i]));
- }
- }
- return res;
- }
-} \ No newline at end of file
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Johannes Lerch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.calls.net;
+
+import static org.eclipse.recommenders.utils.Checks.ensureEquals;
+import static org.eclipse.recommenders.utils.Constants.N_NODEID_CALL_GROUPS;
+import static org.eclipse.recommenders.utils.Constants.N_NODEID_CONTEXT;
+import static org.eclipse.recommenders.utils.Constants.N_NODEID_DEF;
+import static org.eclipse.recommenders.utils.Constants.N_NODEID_DEF_KIND;
+import static org.eclipse.recommenders.utils.Constants.N_STATE_DUMMY_DEF;
+import static org.eclipse.recommenders.utils.Constants.N_STATE_FALSE;
+import static org.eclipse.recommenders.utils.Constants.N_STATE_TRUE;
+import static org.eclipse.recommenders.utils.Constants.UNKNOWN_METHOD;
+
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.eclipse.recommenders.commons.bayesnet.BayesianNetwork;
+import org.eclipse.recommenders.commons.bayesnet.Node;
+import org.eclipse.recommenders.internal.utils.codestructs.DefinitionSite;
+import org.eclipse.recommenders.internal.utils.codestructs.DefinitionSite.Kind;
+import org.eclipse.recommenders.internal.utils.codestructs.ObjectUsage;
+import org.eclipse.recommenders.jayes.BayesNet;
+import org.eclipse.recommenders.jayes.BayesNode;
+import org.eclipse.recommenders.jayes.inference.junctionTree.JunctionTreeAlgorithm;
+import org.eclipse.recommenders.utils.Constants;
+import org.eclipse.recommenders.utils.Tuple;
+import org.eclipse.recommenders.utils.names.IFieldName;
+import org.eclipse.recommenders.utils.names.IMethodName;
+import org.eclipse.recommenders.utils.names.ITypeName;
+import org.eclipse.recommenders.utils.names.VmMethodName;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+/**
+ * Expected structure:
+ *
+ * <ul>
+ * <li>every node must have at least <b>2 states</b>!
+ * <li>the first state is supposed to be a dummy state. Call it like {@link Constants#N_STATE_DUMMY_CTX}
+ * <li>the second state <b>may</b> to be a dummy state too if no valuable other state could be found.
+ * </ul>
+ *
+ * <ul>
+ * <li><b>callgroup node (formerly called pattern node):</b>
+ * <ul>
+ * <li>node name: {@link Constants#N_NODEID_CALL_GROUPS}
+ * <li>state names: no constraints. recommended schema is to use 'p'#someNumber.
+ * </ul>
+ * <li><b>context node:</b>
+ * <ul>
+ * <li>node name: {@link Constants#N_NODEID_CONTEXT}
+ * <li>state names: fully-qualified method names as returned by {@link IMethodName#getIdentifier()}.
+ * </ul>
+ * <li><b>definition node:</b>
+ * <ul>
+ * <li>node name: {@link Constants#N_NODEID_DEF}
+ * <li>state names: fully-qualified names as returned by {@link IMethodName#getIdentifier()} or
+ * {@link IFieldName#getIdentifier()}.
+ * </ul>
+ * <li><b>definition kind node:</b>
+ * <ul>
+ * <li>node name: {@link Constants#N_NODEID_DEF_KIND}
+ * <li>state names: one of {@link DefinitionSite.Kind}, i.e., METHOD_RETURN, NEW, FIELD, PARAMETER, THIS, UNKNOWN, or
+ * ANY
+ * </ul>
+ * <li><b>method call node:</b>
+ * <ul>
+ * <li>node name: {@link IMethodName#getIdentifier()}
+ * <li>state names: {@link Constants#N_STATE_TRUE} or {@link Constants#N_STATE_FALSE}
+ * </ul>
+ * </ul>
+ */
+
+public class BayesNetWrapper implements IObjectMethodCallsNet {
+
+ private final ITypeName typeName;
+
+ private JunctionTreeAlgorithm junctionTreeAlgorithm;
+
+ private BayesNet bayesNet;
+ private BayesNode callgroupNode;
+ private BayesNode contextNode;
+ private BayesNode kindNode;
+ private BayesNode definitionNode;
+ private final HashMap<IMethodName, BayesNode> callNodes;
+
+ public BayesNetWrapper(final ITypeName name, final BayesianNetwork network) {
+ this.typeName = name;
+ callNodes = new HashMap<IMethodName, BayesNode>();
+ initializeNetwork(network);
+ }
+
+ private void initializeNetwork(final BayesianNetwork network) {
+ bayesNet = new BayesNet();
+ initializeNodes(network);
+ initializeArcs(network);
+ initializeProbabilities(network);
+
+ junctionTreeAlgorithm = new JunctionTreeAlgorithm();
+ junctionTreeAlgorithm.setNetwork(bayesNet);
+ }
+
+ private void initializeNodes(final BayesianNetwork network) {
+ final Collection<Node> nodes = network.getNodes();
+ for (final Node node : nodes) {
+ final BayesNode bayesNode = new BayesNode(node.getIdentifier());
+ final String[] states = node.getStates();
+ for (int i = 0; i < states.length; i++) {
+ bayesNode.addOutcome(states[i]);
+ }
+ bayesNet.addNode(bayesNode);
+
+ if (node.getIdentifier().equals(N_NODEID_CONTEXT)) {
+ contextNode = bayesNode;
+ } else if (node.getIdentifier().equals(N_NODEID_CALL_GROUPS)) {
+ callgroupNode = bayesNode;
+ } else if (node.getIdentifier().equals(N_NODEID_DEF_KIND)) {
+ kindNode = bayesNode;
+ } else if (node.getIdentifier().equals(N_NODEID_DEF)) {
+ definitionNode = bayesNode;
+ } else {
+ final VmMethodName vmMethodName = VmMethodName.get(node.getIdentifier());
+ callNodes.put(vmMethodName, bayesNode);
+ }
+ }
+ }
+
+ private void initializeArcs(final BayesianNetwork network) {
+ final Collection<Node> nodes = network.getNodes();
+ for (final Node node : nodes) {
+ final Node[] parents = node.getParents();
+ final BayesNode children = bayesNet.getNode(node.getIdentifier());
+ final LinkedList<BayesNode> bnParents = new LinkedList<BayesNode>();
+ for (int i = 0; i < parents.length; i++) {
+ bnParents.add(bayesNet.getNode(parents[i].getIdentifier()));
+ }
+ children.setParents(bnParents);
+ }
+ }
+
+ private void initializeProbabilities(final BayesianNetwork network) {
+ final Collection<Node> nodes = network.getNodes();
+ for (final Node node : nodes) {
+ final BayesNode bayesNode = bayesNet.getNode(node.getIdentifier());
+ bayesNode.setProbabilities(node.getProbabilities());
+ }
+ }
+
+ @Override
+ public ITypeName getType() {
+ return typeName;
+ }
+
+ @Override
+ public void clearEvidence() {
+ junctionTreeAlgorithm.setEvidence(new HashMap<BayesNode, String>());
+ }
+
+ @Override
+ public void setMethodContext(final IMethodName newActiveMethodContext) {
+ final String identifier;
+ if (newActiveMethodContext == null) {
+ identifier = UNKNOWN_METHOD.getIdentifier();
+ } else {
+ identifier = newActiveMethodContext.getIdentifier();
+ }
+
+ if (contextNode.getOutcomes().contains(identifier)) {
+ junctionTreeAlgorithm.addEvidence(contextNode, identifier);
+ }
+ }
+
+ @Override
+ public void setKind(final DefinitionSite.Kind newKind) {
+ if (newKind == null) {
+ clearEvidence();
+ return;
+ }
+ final String identifier = newKind.toString();
+ if (kindNode.getOutcomes().contains(identifier)) {
+ junctionTreeAlgorithm.addEvidence(kindNode, identifier);
+ }
+ }
+
+ @Override
+ public void setDefinition(final IMethodName newDefinition) {
+ final String identifier = newDefinition == null ? N_STATE_DUMMY_DEF : newDefinition.getIdentifier();
+ if (definitionNode.getOutcomes().contains(identifier)) {
+ junctionTreeAlgorithm.addEvidence(definitionNode, identifier);
+ }
+ }
+
+ @Override
+ public void setObservedMethodCalls(final ITypeName rebaseType, final Set<IMethodName> invokedMethods) {
+ for (final IMethodName invokedMethod : invokedMethods) {
+ final IMethodName rebased = rebaseType == null ? invokedMethod : VmMethodName.rebase(rebaseType,
+ invokedMethod);
+ setCalled(rebased);
+ }
+
+ if (rebaseType != null) {
+ final IMethodName no = VmMethodName.rebase(rebaseType, Constants.NO_METHOD);
+ setCalled(no, N_STATE_FALSE);
+ }
+ }
+
+ @Override
+ public void setQuery(final ObjectUsage query) {
+ clearEvidence();
+ setMethodContext(query.contextFirst);
+ setKind(query.kind);
+ if (query.definition != null && !query.definition.equals(UNKNOWN_METHOD))
+ setDefinition(query.definition);
+ setObservedMethodCalls(query.type, query.calls);
+ }
+
+ @Override
+ public void setCalled(final IMethodName calledMethod) {
+ setCalled(calledMethod, N_STATE_TRUE);
+ }
+
+ public void setCalled(final IMethodName calledMethod, String state) {
+ final BayesNode node = bayesNet.getNode(calledMethod.getIdentifier());
+ if (node != null) {
+ junctionTreeAlgorithm.addEvidence(node, state);
+ }
+ }
+
+ @Override
+ public SortedSet<Tuple<IMethodName, Double>> getRecommendedMethodCalls(final double minProbabilityThreshold) {
+
+ final TreeSet<Tuple<IMethodName, Double>> res = createSortedSet();
+
+ for (final IMethodName method : callNodes.keySet()) {
+ final BayesNode bayesNode = callNodes.get(method);
+ final boolean isAlreadyUsedAsEvidence = junctionTreeAlgorithm.getEvidence().containsKey(bayesNode);
+ if (!isAlreadyUsedAsEvidence) {
+ final int indexForTrue = bayesNode.getOutcomeIndex(N_STATE_TRUE);
+ final double[] probabilities = junctionTreeAlgorithm.getBeliefs(bayesNode);
+ final double probability = probabilities[indexForTrue];
+ if (probability >= minProbabilityThreshold) {
+ res.add(Tuple.newTuple(method, probability));
+ }
+ }
+ }
+
+ return res;
+ }
+
+ private TreeSet<Tuple<IMethodName, Double>> createSortedSet() {
+ final TreeSet<Tuple<IMethodName, Double>> res = Sets.newTreeSet(new Comparator<Tuple<IMethodName, Double>>() {
+
+ @Override
+ public int compare(final Tuple<IMethodName, Double> o1, final Tuple<IMethodName, Double> o2) {
+ // the higher probability will be sorted above the lower values:
+ final int probabilityCompare = Double.compare(o2.getSecond(), o1.getSecond());
+ return probabilityCompare != 0 ? probabilityCompare : o1.getFirst().compareTo(o2.getFirst());
+ }
+ });
+ return res;
+ }
+
+ @Override
+ public SortedSet<Tuple<IMethodName, Double>> getRecommendedMethodCalls(final double minProbabilityThreshold,
+ final int maxNumberOfRecommendations) {
+ final SortedSet<Tuple<IMethodName, Double>> recommendations = getRecommendedMethodCalls(minProbabilityThreshold);
+ if (recommendations.size() <= maxNumberOfRecommendations) {
+ return recommendations;
+ }
+ // need to remove smaller items:
+ final Tuple<IMethodName, Double> firstExcludedRecommendation = Iterables.get(recommendations,
+ maxNumberOfRecommendations);
+ final SortedSet<Tuple<IMethodName, Double>> res = recommendations.headSet(firstExcludedRecommendation);
+ ensureEquals(res.size(), maxNumberOfRecommendations,
+ "filter op did not return expected number of compilationUnits2recommendationsIndex");
+ return res;
+ }
+
+ @Override
+ public List<Tuple<String, Double>> getPatternsWithProbability() {
+ final double[] probs = junctionTreeAlgorithm.getBeliefs(callgroupNode);
+ final List<Tuple<String, Double>> res = Lists.newArrayListWithCapacity(probs.length);
+ final Set<String> outcomes = callgroupNode.getOutcomes();
+ for (final String outcome : outcomes) {
+ final int probIndex = callgroupNode.getOutcomeIndex(outcome);
+ final double p = probs[probIndex];
+ if (0.01 > p) {
+ continue;
+ }
+ res.add(Tuple.newTuple(outcome, p));
+ }
+ return res;
+ }
+
+ @Override
+ public void setPattern(final String patternName) {
+ junctionTreeAlgorithm.addEvidence(callgroupNode, patternName);
+ }
+
+ @Override
+ public Collection<IMethodName> getMethodCalls() {
+ return new LinkedList<IMethodName>(callNodes.keySet());
+ }
+
+ @Override
+ public Collection<IMethodName> getContexts() {
+ final Set<String> outcomes = contextNode.getOutcomes();
+ final LinkedList<IMethodName> result = new LinkedList<IMethodName>();
+ for (final String outcome : outcomes) {
+ result.add(VmMethodName.get(outcome));
+ }
+ return result;
+ }
+
+ @Override
+ public IMethodName getActiveContext() {
+ return computeMethodNameFromState(contextNode);
+ }
+
+ private IMethodName computeMethodNameFromState(final BayesNode node) {
+ final String stateId = junctionTreeAlgorithm.getEvidence().get(node);
+ if (stateId == null) {
+ return VmMethodName.NULL;
+ }
+ return VmMethodName.get(stateId);
+ }
+
+ @Override
+ public IMethodName getActiveDefinition() {
+ return computeMethodNameFromState(definitionNode);
+ }
+
+ @Override
+ public Kind getActiveKind() {
+ final String stateId = junctionTreeAlgorithm.getEvidence().get(kindNode);
+ if (stateId == null) {
+ return Kind.UNKNOWN;
+ }
+ return Kind.valueOf(stateId);
+ }
+
+ @Override
+ public Set<IMethodName> getActiveCalls() {
+ final TreeSet<IMethodName> res = Sets.newTreeSet();
+ final Map<BayesNode, String> evidence = junctionTreeAlgorithm.getEvidence();
+ for (final BayesNode methodNode : callNodes.values()) {
+ if (evidence.containsKey(methodNode) && evidence.get(methodNode).equals(Constants.N_STATE_TRUE)) {
+ res.add(VmMethodName.get(methodNode.getName()));
+ }
+ }
+ // remove the NULL that may have been introduced by res.add(compute...)
+ res.remove(VmMethodName.NULL);
+ return res;
+ }
+
+ @Override
+ public Set<Tuple<String, Double>> getDefinitions() {
+ Set<Tuple<String, Double>> res = Sets.newHashSet();
+ double[] beliefs = junctionTreeAlgorithm.getBeliefs(definitionNode);
+ for (int i = definitionNode.getOutcomeCount(); i-- > 0;) {
+ if (beliefs[i] > 0.05) {
+ String outcomeName = definitionNode.getOutcomeName(i);
+ if (outcomeName.equals("LNone.none()V")) {
+ continue;
+ }
+ if (outcomeName.equals(UNKNOWN_METHOD.getIdentifier())) {
+ continue;
+ }
+ res.add(Tuple.newTuple(outcomeName, beliefs[i]));
+ }
+ }
+ return res;
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/net/IObjectMethodCallsNet.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/net/IObjectMethodCallsNet.java
index b08e84b..727ec55 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/net/IObjectMethodCallsNet.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/net/IObjectMethodCallsNet.java
@@ -1,67 +1,67 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Johannes Lerch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.calls.net;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-import java.util.SortedSet;
-
-import org.eclipse.recommenders.internal.utils.codestructs.DefinitionSite;
-import org.eclipse.recommenders.internal.utils.codestructs.DefinitionSite.Kind;
-import org.eclipse.recommenders.internal.utils.codestructs.ObjectUsage;
-import org.eclipse.recommenders.utils.Tuple;
-import org.eclipse.recommenders.utils.annotations.Nullable;
-import org.eclipse.recommenders.utils.names.IMethodName;
-import org.eclipse.recommenders.utils.names.ITypeName;
-
-public interface IObjectMethodCallsNet {
-
- public abstract ITypeName getType();
-
- public abstract void setCalled(final IMethodName calledMethod);
-
- public abstract void clearEvidence();
-
- public abstract void setMethodContext(final IMethodName newActiveMethodContext);
-
- public abstract void setKind(final DefinitionSite.Kind newKind);
-
- public abstract void setDefinition(final IMethodName newDefinition);
-
- public abstract void setObservedMethodCalls(final @Nullable ITypeName rebaseType,
- final Set<IMethodName> invokedMethods);
-
- public abstract void setQuery(final ObjectUsage query);
-
- public abstract SortedSet<Tuple<IMethodName, Double>> getRecommendedMethodCalls(final double minProbabilityThreshold);
-
- public abstract SortedSet<Tuple<IMethodName, Double>> getRecommendedMethodCalls(
- final double minProbabilityThreshold, final int maxNumberOfRecommendations);
-
- public abstract List<Tuple<String, Double>> getPatternsWithProbability();
-
- public abstract void setPattern(final String patternName);
-
- public abstract Collection<IMethodName> getMethodCalls();
-
- public abstract Collection<IMethodName> getContexts();
-
- public abstract IMethodName getActiveContext();
-
- public abstract IMethodName getActiveDefinition();
-
- public abstract Kind getActiveKind();
-
- public abstract Set<IMethodName> getActiveCalls();
-
- public abstract Set<Tuple<String, Double>> getDefinitions();
-} \ No newline at end of file
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Johannes Lerch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.calls.net;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.SortedSet;
+
+import org.eclipse.recommenders.internal.utils.codestructs.DefinitionSite;
+import org.eclipse.recommenders.internal.utils.codestructs.DefinitionSite.Kind;
+import org.eclipse.recommenders.internal.utils.codestructs.ObjectUsage;
+import org.eclipse.recommenders.utils.Tuple;
+import org.eclipse.recommenders.utils.annotations.Nullable;
+import org.eclipse.recommenders.utils.names.IMethodName;
+import org.eclipse.recommenders.utils.names.ITypeName;
+
+public interface IObjectMethodCallsNet {
+
+ public abstract ITypeName getType();
+
+ public abstract void setCalled(final IMethodName calledMethod);
+
+ public abstract void clearEvidence();
+
+ public abstract void setMethodContext(final IMethodName newActiveMethodContext);
+
+ public abstract void setKind(final DefinitionSite.Kind newKind);
+
+ public abstract void setDefinition(final IMethodName newDefinition);
+
+ public abstract void setObservedMethodCalls(final @Nullable ITypeName rebaseType,
+ final Set<IMethodName> invokedMethods);
+
+ public abstract void setQuery(final ObjectUsage query);
+
+ public abstract SortedSet<Tuple<IMethodName, Double>> getRecommendedMethodCalls(final double minProbabilityThreshold);
+
+ public abstract SortedSet<Tuple<IMethodName, Double>> getRecommendedMethodCalls(
+ final double minProbabilityThreshold, final int maxNumberOfRecommendations);
+
+ public abstract List<Tuple<String, Double>> getPatternsWithProbability();
+
+ public abstract void setPattern(final String patternName);
+
+ public abstract Collection<IMethodName> getMethodCalls();
+
+ public abstract Collection<IMethodName> getContexts();
+
+ public abstract IMethodName getActiveContext();
+
+ public abstract IMethodName getActiveDefinition();
+
+ public abstract Kind getActiveKind();
+
+ public abstract Set<IMethodName> getActiveCalls();
+
+ public abstract Set<Tuple<String, Double>> getDefinitions();
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/CallPreferencePage.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/CallPreferencePage.java
index 383c00b..09da803 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/CallPreferencePage.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/CallPreferencePage.java
@@ -1,355 +1,355 @@
-/**
- * Copyright (c) 2010, 2012 Darmstadt University of Technology.
- * 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:
- * Johannes Lerch - initial API and implementation.
- * Marcel Bruch - adapted UI for latest model archive store.
- * Patrick Gottschaemmer, Olav Lenz - externalize Strings.
- */
-package org.eclipse.recommenders.internal.completion.rcp.calls.preferences;
-
-import static org.apache.commons.lang3.builder.CompareToBuilder.reflectionCompare;
-import static org.eclipse.recommenders.internal.completion.rcp.calls.wiring.CallsCompletionPlugin.PLUGIN_ID;
-import static org.eclipse.recommenders.utils.Checks.cast;
-import static org.eclipse.swt.SWT.BORDER;
-import static org.eclipse.swt.SWT.READ_ONLY;
-
-import java.io.File;
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.eclipse.core.databinding.DataBindingContext;
-import org.eclipse.core.databinding.beans.BeanProperties;
-import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.core.databinding.observable.value.WritableValue;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jface.databinding.swt.WidgetProperties;
-import org.eclipse.jface.databinding.viewers.ViewerProperties;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.layout.TableColumnLayout;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.preference.IntegerFieldEditor;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.recommenders.completion.rcp.calls.l10n.Messages;
-import org.eclipse.recommenders.internal.completion.rcp.calls.engine.CallsCompletionProposalComputer;
-import org.eclipse.recommenders.internal.completion.rcp.calls.net.IObjectMethodCallsNet;
-import org.eclipse.recommenders.internal.completion.rcp.calls.wiring.CallsCompletionPlugin;
-import org.eclipse.recommenders.internal.rcp.models.IModelArchiveStore;
-import org.eclipse.recommenders.internal.rcp.models.ModelArchiveMetadata;
-import org.eclipse.recommenders.internal.rcp.models.ModelArchiveMetadata.ModelArchiveResolutionStatus;
-import org.eclipse.recommenders.rcp.ClasspathEntryInfo;
-import org.eclipse.recommenders.rcp.IClasspathEntryInfoProvider;
-import org.eclipse.recommenders.rcp.repo.IModelRepository;
-import org.eclipse.recommenders.utils.Tuple;
-import org.eclipse.recommenders.utils.rcp.RCPUtils;
-import org.eclipse.recommenders.utils.rcp.internal.ContentAssistEnablementBlock;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
-
-public class CallPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IPropertyChangeListener {
-
- public static final String ID_MAX_PROPOSALS = "recommenders.calls.max_proposals"; //$NON-NLS-1$
- public static final String ID_MIN_PROBABILITY = "recommenders.calls.min_probability"; //$NON-NLS-1$
-
- private final IClasspathEntryInfoProvider cpeInfoProvider;
- private final IModelArchiveStore<IType, IObjectMethodCallsNet> modelStore;
- private List<Tuple<ClasspathEntryInfo, ModelArchiveMetadata<?, ?>>> mappings;
- final IModelRepository repository;
-
- private ContentAssistEnablementBlock enablement;
- private IntegerFieldEditor maxProposals;
- private IntegerFieldEditor minProbability;
-
- private Text rootName;
- private Text rootVersion;
- private Text rootFingerprint;
- private Text modelCoordinate;
- private ComboViewer modelStatus;
- private TableViewer tableViewer;
- private WritableValue mValue;
- private WritableValue rValue;
-
- @Inject
- public CallPreferencePage(final IClasspathEntryInfoProvider cpeInfoProvider,
- final IModelArchiveStore<IType, IObjectMethodCallsNet> modelStore, final IModelRepository repository) {
- this.cpeInfoProvider = cpeInfoProvider;
- this.modelStore = modelStore;
- this.repository = repository;
- }
-
- @Override
- public void init(final IWorkbench workbench) {
- setPreferenceStore(CallsCompletionPlugin.getDefault().getPreferenceStore());
- setDescription(Messages.PREFPAGE_DESCRIPTION);
- }
-
- @Override
- protected Control createContents(final Composite parent) {
- final Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- createConfigurationBlock(composite);
- createModelInformationBlock(composite);
- return composite;
- }
-
- private void createConfigurationBlock(final Composite composite) {
- enablement = new ContentAssistEnablementBlock(composite, Messages.PREFPAGE_ENABLE_CALL_COMPLETION,
- CallsCompletionProposalComputer.CATEGORY_ID);
- final Composite group = new Composite(composite, SWT.NONE);
- group.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
- group.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
- maxProposals = createIntegerField(group, ID_MAX_PROPOSALS, Messages.PREFPAGE_MAX_NUMBER_OF_PROPOSALS, 1, 100);
- minProbability = createIntegerField(group, ID_MIN_PROBABILITY, Messages.PREFPAGE_MIN_PROBABILITY_OF_PROPOSAL,
- 1, 100);
- }
-
- private IntegerFieldEditor createIntegerField(final Composite parent, final String name, final String text,
- final int min, final int max) {
- final IntegerFieldEditor editor = new IntegerFieldEditor(name, text, parent);
- editor.setPreferenceStore(getPreferenceStore());
- editor.setPage(this);
- editor.setValidRange(min, max);
- editor.setPropertyChangeListener(this);
- editor.load();
- return editor;
- }
-
- private void createModelInformationBlock(final Composite composite) {
- new Label(composite, SWT.NONE).setText(Messages.PREFPAGE_TABLE_DESCRIPTION);
- computeMappings();
- final SashForm form = new SashForm(composite, SWT.HORIZONTAL);
- form.setLayout(new FillLayout());
- createTable(form);
- createDetails(form);
- bindValues();
- form.setWeights(new int[] { 50, 50 });
- }
-
- private void computeMappings() {
- mappings = Lists.newLinkedList();
- for (final File root : cpeInfoProvider.getFiles()) {
- final Optional<ClasspathEntryInfo> opt = cpeInfoProvider.getInfo(root);
- if (!opt.isPresent()) {
- continue;
- }
- final ClasspathEntryInfo cpei = opt.get();
-
- final ModelArchiveMetadata<?, ?> metadata = modelStore.findOrCreateMetadata(root);
- final Tuple<ClasspathEntryInfo, ModelArchiveMetadata<?, ?>> entry = Tuple.newTuple(cpei, metadata);
- mappings.add(entry);
- }
- }
-
- private void bindValues() {
- final DataBindingContext ctx = new DataBindingContext();
- {
- rValue = new WritableValue();
- bindValue(ctx, rootName, ClasspathEntryInfo.class, ClasspathEntryInfo.P_SYMBOLIC_NAME, rValue);
- bindValue(ctx, rootFingerprint, ClasspathEntryInfo.class, ClasspathEntryInfo.P_FINGERPRINT, rValue);
- bindValue(ctx, rootVersion, ClasspathEntryInfo.class, ClasspathEntryInfo.P_VERSION, rValue);
- }
- {
- mValue = new WritableValue();
- bindValue(ctx, modelCoordinate, ModelArchiveMetadata.class, ModelArchiveMetadata.P_COORDINATE, mValue);
-
- final IObservableValue widgetValue = ViewerProperties.singlePostSelection().observe(modelStatus);
- final IObservableValue modelValue = BeanProperties.value(ModelArchiveMetadata.class,
- ModelArchiveMetadata.P_STATUS).observeDetail(mValue);
- ctx.bindValue(widgetValue, modelValue);
- }
- }
-
- private void bindValue(final DataBindingContext ctx, final Widget widget, final Class<?> clazz,
- final String property, final IObservableValue value) {
- final IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(widget);
- final IObservableValue modelValue = BeanProperties.value(clazz, property).observeDetail(value);
- ctx.bindValue(widgetValue, modelValue);
- }
-
- private void createDetails(final SashForm form) {
- final Composite parent = new Composite(form, SWT.NONE);
- parent.setLayout(new GridLayout());
- final GridDataFactory f = GridDataFactory.fillDefaults().grab(true, false);
- {
- final Group rootContainer = new Group(parent, SWT.SHADOW_ETCHED_IN);
- rootContainer.setText(Messages.PREFPAGE_PACKAGE_ROOT_INFO);
- rootContainer.setLayout(new GridLayout(2, false));
- rootContainer.setLayoutData(f.create());
-
- createLabel(rootContainer, Messages.PREFPAGE_PACKAGE_ROOT_NAME);
- rootName = createText(rootContainer, READ_ONLY | BORDER);
-
- createLabel(rootContainer, Messages.PREFPAGE_PACKAGE_ROOT_VERSION);
- rootVersion = createText(rootContainer, READ_ONLY | BORDER);
-
- createLabel(rootContainer, Messages.PREFPAGE_PACKAGE_ROOT_FINGERPRINT);
- rootFingerprint = createText(rootContainer, READ_ONLY | BORDER);
- }
- {
- final Group modelContainer = new Group(parent, SWT.SHADOW_ETCHED_IN);
- modelContainer.setText(Messages.PREFPAGE_MODEL_INFO);
- modelContainer.setLayout(new GridLayout(2, false));
- modelContainer.setLayoutData(f.create());
-
- createLabel(modelContainer, Messages.PREFPAGE_MODEL_CCORDINATE);
- modelCoordinate = createText(modelContainer, SWT.BORDER);
-
- createLabel(modelContainer, Messages.PREFPAGE_MODEL_RESOLUTION_STATUS);
- modelStatus = new ComboViewer(modelContainer, SWT.BORDER);
- modelStatus.setContentProvider(new ArrayContentProvider());
- modelStatus.setInput(ModelArchiveResolutionStatus.values());
- }
- }
-
- private void createTable(final Composite container) {
- final ScrolledComposite sc = new ScrolledComposite(container, SWT.H_SCROLL | SWT.V_SCROLL);
- sc.setLayoutData(new GridLayout());
- sc.setExpandHorizontal(true);
- final Composite tContainer = new Composite(sc, SWT.NONE);
- tContainer.setSize(200, 500);
- tableViewer = new TableViewer(tContainer, SWT.FULL_SELECTION);
- final Table table = tableViewer.getTable();
- table.setHeaderVisible(true);
- tableViewer.setContentProvider(new ArrayContentProvider());
- tableViewer.setComparator(new ViewerComparator() {
- @Override
- public int compare(final Viewer viewer, final Object e1, final Object e2) {
- final Tuple<ClasspathEntryInfo, ModelArchiveMetadata<?, ?>> t1 = cast(e1);
- final File f1 = t1.getSecond().getLocation();
- final Tuple<ClasspathEntryInfo, ModelArchiveMetadata<?, ?>> t2 = cast(e2);
- final File f2 = t2.getSecond().getLocation();
- return reflectionCompare(f1, f2);
- }
- });
- tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(final SelectionChangedEvent event) {
- final Optional<Tuple<ClasspathEntryInfo, ModelArchiveMetadata<?, ?>>> e = RCPUtils.first(event
- .getSelection());
- mValue.setValue(e.get().getSecond());
- rValue.setValue(e.get().getFirst());
- }
- });
-
- final TableColumnLayout tableColumnLayout = new TableColumnLayout();
- final Image versionImage = loadImage("/icons/obj16/file_version.png"); //$NON-NLS-1$
- final Image versionUnknownImage = loadImage("/icons/obj16/file_version_unknown.png"); //$NON-NLS-1$
- final Image modelImage = loadImage("/icons/obj16/model.png"); //$NON-NLS-1$
- final Image modelUnknownImage = loadImage("/icons/obj16/model_unknown.png"); //$NON-NLS-1$
-
- ColumnViewerToolTipSupport.enableFor(tableViewer);
- TableViewerColumn column = createTableViewerColumn(tableViewer, Messages.PREFPAGE_TABLE_COLUMN_FILE, 200, 0);
- tableColumnLayout.setColumnData(column.getColumn(), new ColumnWeightData(100));
- column.setLabelProvider(new PackageFragmentRootLabelProvider());
-
- column = createTableViewerColumn(tableViewer, "", 20, 1); //$NON-NLS-1$
- tableColumnLayout.setColumnData(column.getColumn(), new ColumnPixelData(20));
- column.setLabelProvider(new VersionLabelProvider(versionUnknownImage, versionImage));
-
- column = createTableViewerColumn(tableViewer, "", 20, 2); //$NON-NLS-1$
- tableColumnLayout.setColumnData(column.getColumn(), new ColumnPixelData(20));
- column.setLabelProvider(new ModelLabelProvider(repository, modelImage, modelUnknownImage));
- tContainer.setLayout(tableColumnLayout);
- tableViewer.setInput(mappings);
-
- sc.setContent(tContainer);
- }
-
- protected Text createText(final Composite parent, final int style) {
- final Text text = new Text(parent, style);
- text.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(150, SWT.DEFAULT)
- .align(GridData.FILL, GridData.BEGINNING).create());
- return text;
- }
-
- protected Image loadImage(final String name) {
- final ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, name);
- return desc.createImage();
- }
-
- protected Label createLabel(final Composite parent, final String text) {
- final Label label = new Label(parent, SWT.NONE);
- label.setText(text);
- return label;
- }
-
- private TableViewerColumn createTableViewerColumn(final TableViewer viewer, final String title, final int bound,
- final int colNumber) {
- final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE);
- final TableColumn column = viewerColumn.getColumn();
- column.setText(title);
- column.setWidth(bound);
- column.setResizable(false);
- column.setMoveable(false);
- return viewerColumn;
- }
-
- @Override
- protected void performDefaults() {
- maxProposals.loadDefault();
- minProbability.loadDefault();
- }
-
- @Override
- public boolean performOk() {
- maxProposals.store();
- minProbability.store();
- return super.performOk();
- }
-
- @Override
- public void setVisible(final boolean visible) {
- // respond to changes in Java > Editor > Content Assist > Advanced:
- // this works only one-way. We respond to changes made in JDT but JDT page may show deprecated values.
- enablement.loadSelection();
- super.setVisible(visible);
- }
-
- @Override
- public void propertyChange(final PropertyChangeEvent event) {
- if (event.getProperty().equals(FieldEditor.IS_VALID)) {
- setValid(maxProposals.isValid() && minProbability.isValid());
- }
- }
-
-}
+/**
+ * Copyright (c) 2010, 2012 Darmstadt University of Technology.
+ * 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:
+ * Johannes Lerch - initial API and implementation.
+ * Marcel Bruch - adapted UI for latest model archive store.
+ * Patrick Gottschaemmer, Olav Lenz - externalize Strings.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.calls.preferences;
+
+import static org.apache.commons.lang3.builder.CompareToBuilder.reflectionCompare;
+import static org.eclipse.recommenders.internal.completion.rcp.calls.wiring.CallsCompletionPlugin.PLUGIN_ID;
+import static org.eclipse.recommenders.utils.Checks.cast;
+import static org.eclipse.swt.SWT.BORDER;
+import static org.eclipse.swt.SWT.READ_ONLY;
+
+import java.io.File;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.jface.databinding.viewers.ViewerProperties;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.layout.TableColumnLayout;
+import org.eclipse.jface.preference.FieldEditor;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnPixelData;
+import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.recommenders.completion.rcp.calls.l10n.Messages;
+import org.eclipse.recommenders.internal.completion.rcp.calls.engine.CallsCompletionProposalComputer;
+import org.eclipse.recommenders.internal.completion.rcp.calls.net.IObjectMethodCallsNet;
+import org.eclipse.recommenders.internal.completion.rcp.calls.wiring.CallsCompletionPlugin;
+import org.eclipse.recommenders.internal.rcp.models.IModelArchiveStore;
+import org.eclipse.recommenders.internal.rcp.models.ModelArchiveMetadata;
+import org.eclipse.recommenders.internal.rcp.models.ModelArchiveMetadata.ModelArchiveResolutionStatus;
+import org.eclipse.recommenders.rcp.ClasspathEntryInfo;
+import org.eclipse.recommenders.rcp.IClasspathEntryInfoProvider;
+import org.eclipse.recommenders.rcp.repo.IModelRepository;
+import org.eclipse.recommenders.utils.Tuple;
+import org.eclipse.recommenders.utils.rcp.RCPUtils;
+import org.eclipse.recommenders.utils.rcp.internal.ContentAssistEnablementBlock;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.Lists;
+
+public class CallPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IPropertyChangeListener {
+
+ public static final String ID_MAX_PROPOSALS = "recommenders.calls.max_proposals"; //$NON-NLS-1$
+ public static final String ID_MIN_PROBABILITY = "recommenders.calls.min_probability"; //$NON-NLS-1$
+
+ private final IClasspathEntryInfoProvider cpeInfoProvider;
+ private final IModelArchiveStore<IType, IObjectMethodCallsNet> modelStore;
+ private List<Tuple<ClasspathEntryInfo, ModelArchiveMetadata<?, ?>>> mappings;
+ final IModelRepository repository;
+
+ private ContentAssistEnablementBlock enablement;
+ private IntegerFieldEditor maxProposals;
+ private IntegerFieldEditor minProbability;
+
+ private Text rootName;
+ private Text rootVersion;
+ private Text rootFingerprint;
+ private Text modelCoordinate;
+ private ComboViewer modelStatus;
+ private TableViewer tableViewer;
+ private WritableValue mValue;
+ private WritableValue rValue;
+
+ @Inject
+ public CallPreferencePage(final IClasspathEntryInfoProvider cpeInfoProvider,
+ final IModelArchiveStore<IType, IObjectMethodCallsNet> modelStore, final IModelRepository repository) {
+ this.cpeInfoProvider = cpeInfoProvider;
+ this.modelStore = modelStore;
+ this.repository = repository;
+ }
+
+ @Override
+ public void init(final IWorkbench workbench) {
+ setPreferenceStore(CallsCompletionPlugin.getDefault().getPreferenceStore());
+ setDescription(Messages.PREFPAGE_DESCRIPTION);
+ }
+
+ @Override
+ protected Control createContents(final Composite parent) {
+ final Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ createConfigurationBlock(composite);
+ createModelInformationBlock(composite);
+ return composite;
+ }
+
+ private void createConfigurationBlock(final Composite composite) {
+ enablement = new ContentAssistEnablementBlock(composite, Messages.PREFPAGE_ENABLE_CALL_COMPLETION,
+ CallsCompletionProposalComputer.CATEGORY_ID);
+ final Composite group = new Composite(composite, SWT.NONE);
+ group.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).create());
+ group.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
+ maxProposals = createIntegerField(group, ID_MAX_PROPOSALS, Messages.PREFPAGE_MAX_NUMBER_OF_PROPOSALS, 1, 100);
+ minProbability = createIntegerField(group, ID_MIN_PROBABILITY, Messages.PREFPAGE_MIN_PROBABILITY_OF_PROPOSAL,
+ 1, 100);
+ }
+
+ private IntegerFieldEditor createIntegerField(final Composite parent, final String name, final String text,
+ final int min, final int max) {
+ final IntegerFieldEditor editor = new IntegerFieldEditor(name, text, parent);
+ editor.setPreferenceStore(getPreferenceStore());
+ editor.setPage(this);
+ editor.setValidRange(min, max);
+ editor.setPropertyChangeListener(this);
+ editor.load();
+ return editor;
+ }
+
+ private void createModelInformationBlock(final Composite composite) {
+ new Label(composite, SWT.NONE).setText(Messages.PREFPAGE_TABLE_DESCRIPTION);
+ computeMappings();
+ final SashForm form = new SashForm(composite, SWT.HORIZONTAL);
+ form.setLayout(new FillLayout());
+ createTable(form);
+ createDetails(form);
+ bindValues();
+ form.setWeights(new int[] { 50, 50 });
+ }
+
+ private void computeMappings() {
+ mappings = Lists.newLinkedList();
+ for (final File root : cpeInfoProvider.getFiles()) {
+ final Optional<ClasspathEntryInfo> opt = cpeInfoProvider.getInfo(root);
+ if (!opt.isPresent()) {
+ continue;
+ }
+ final ClasspathEntryInfo cpei = opt.get();
+
+ final ModelArchiveMetadata<?, ?> metadata = modelStore.findOrCreateMetadata(root);
+ final Tuple<ClasspathEntryInfo, ModelArchiveMetadata<?, ?>> entry = Tuple.newTuple(cpei, metadata);
+ mappings.add(entry);
+ }
+ }
+
+ private void bindValues() {
+ final DataBindingContext ctx = new DataBindingContext();
+ {
+ rValue = new WritableValue();
+ bindValue(ctx, rootName, ClasspathEntryInfo.class, ClasspathEntryInfo.P_SYMBOLIC_NAME, rValue);
+ bindValue(ctx, rootFingerprint, ClasspathEntryInfo.class, ClasspathEntryInfo.P_FINGERPRINT, rValue);
+ bindValue(ctx, rootVersion, ClasspathEntryInfo.class, ClasspathEntryInfo.P_VERSION, rValue);
+ }
+ {
+ mValue = new WritableValue();
+ bindValue(ctx, modelCoordinate, ModelArchiveMetadata.class, ModelArchiveMetadata.P_COORDINATE, mValue);
+
+ final IObservableValue widgetValue = ViewerProperties.singlePostSelection().observe(modelStatus);
+ final IObservableValue modelValue = BeanProperties.value(ModelArchiveMetadata.class,
+ ModelArchiveMetadata.P_STATUS).observeDetail(mValue);
+ ctx.bindValue(widgetValue, modelValue);
+ }
+ }
+
+ private void bindValue(final DataBindingContext ctx, final Widget widget, final Class<?> clazz,
+ final String property, final IObservableValue value) {
+ final IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(widget);
+ final IObservableValue modelValue = BeanProperties.value(clazz, property).observeDetail(value);
+ ctx.bindValue(widgetValue, modelValue);
+ }
+
+ private void createDetails(final SashForm form) {
+ final Composite parent = new Composite(form, SWT.NONE);
+ parent.setLayout(new GridLayout());
+ final GridDataFactory f = GridDataFactory.fillDefaults().grab(true, false);
+ {
+ final Group rootContainer = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ rootContainer.setText(Messages.PREFPAGE_PACKAGE_ROOT_INFO);
+ rootContainer.setLayout(new GridLayout(2, false));
+ rootContainer.setLayoutData(f.create());
+
+ createLabel(rootContainer, Messages.PREFPAGE_PACKAGE_ROOT_NAME);
+ rootName = createText(rootContainer, READ_ONLY | BORDER);
+
+ createLabel(rootContainer, Messages.PREFPAGE_PACKAGE_ROOT_VERSION);
+ rootVersion = createText(rootContainer, READ_ONLY | BORDER);
+
+ createLabel(rootContainer, Messages.PREFPAGE_PACKAGE_ROOT_FINGERPRINT);
+ rootFingerprint = createText(rootContainer, READ_ONLY | BORDER);
+ }
+ {
+ final Group modelContainer = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ modelContainer.setText(Messages.PREFPAGE_MODEL_INFO);
+ modelContainer.setLayout(new GridLayout(2, false));
+ modelContainer.setLayoutData(f.create());
+
+ createLabel(modelContainer, Messages.PREFPAGE_MODEL_CCORDINATE);
+ modelCoordinate = createText(modelContainer, SWT.BORDER);
+
+ createLabel(modelContainer, Messages.PREFPAGE_MODEL_RESOLUTION_STATUS);
+ modelStatus = new ComboViewer(modelContainer, SWT.BORDER);
+ modelStatus.setContentProvider(new ArrayContentProvider());
+ modelStatus.setInput(ModelArchiveResolutionStatus.values());
+ }
+ }
+
+ private void createTable(final Composite container) {
+ final ScrolledComposite sc = new ScrolledComposite(container, SWT.H_SCROLL | SWT.V_SCROLL);
+ sc.setLayoutData(new GridLayout());
+ sc.setExpandHorizontal(true);
+ final Composite tContainer = new Composite(sc, SWT.NONE);
+ tContainer.setSize(200, 500);
+ tableViewer = new TableViewer(tContainer, SWT.FULL_SELECTION);
+ final Table table = tableViewer.getTable();
+ table.setHeaderVisible(true);
+ tableViewer.setContentProvider(new ArrayContentProvider());
+ tableViewer.setComparator(new ViewerComparator() {
+ @Override
+ public int compare(final Viewer viewer, final Object e1, final Object e2) {
+ final Tuple<ClasspathEntryInfo, ModelArchiveMetadata<?, ?>> t1 = cast(e1);
+ final File f1 = t1.getSecond().getLocation();
+ final Tuple<ClasspathEntryInfo, ModelArchiveMetadata<?, ?>> t2 = cast(e2);
+ final File f2 = t2.getSecond().getLocation();
+ return reflectionCompare(f1, f2);
+ }
+ });
+ tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(final SelectionChangedEvent event) {
+ final Optional<Tuple<ClasspathEntryInfo, ModelArchiveMetadata<?, ?>>> e = RCPUtils.first(event
+ .getSelection());
+ mValue.setValue(e.get().getSecond());
+ rValue.setValue(e.get().getFirst());
+ }
+ });
+
+ final TableColumnLayout tableColumnLayout = new TableColumnLayout();
+ final Image versionImage = loadImage("/icons/obj16/file_version.png"); //$NON-NLS-1$
+ final Image versionUnknownImage = loadImage("/icons/obj16/file_version_unknown.png"); //$NON-NLS-1$
+ final Image modelImage = loadImage("/icons/obj16/model.png"); //$NON-NLS-1$
+ final Image modelUnknownImage = loadImage("/icons/obj16/model_unknown.png"); //$NON-NLS-1$
+
+ ColumnViewerToolTipSupport.enableFor(tableViewer);
+ TableViewerColumn column = createTableViewerColumn(tableViewer, Messages.PREFPAGE_TABLE_COLUMN_FILE, 200, 0);
+ tableColumnLayout.setColumnData(column.getColumn(), new ColumnWeightData(100));
+ column.setLabelProvider(new PackageFragmentRootLabelProvider());
+
+ column = createTableViewerColumn(tableViewer, "", 20, 1); //$NON-NLS-1$
+ tableColumnLayout.setColumnData(column.getColumn(), new ColumnPixelData(20));
+ column.setLabelProvider(new VersionLabelProvider(versionUnknownImage, versionImage));
+
+ column = createTableViewerColumn(tableViewer, "", 20, 2); //$NON-NLS-1$
+ tableColumnLayout.setColumnData(column.getColumn(), new ColumnPixelData(20));
+ column.setLabelProvider(new ModelLabelProvider(repository, modelImage, modelUnknownImage));
+ tContainer.setLayout(tableColumnLayout);
+ tableViewer.setInput(mappings);
+
+ sc.setContent(tContainer);
+ }
+
+ protected Text createText(final Composite parent, final int style) {
+ final Text text = new Text(parent, style);
+ text.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(150, SWT.DEFAULT)
+ .align(GridData.FILL, GridData.BEGINNING).create());
+ return text;
+ }
+
+ protected Image loadImage(final String name) {
+ final ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, name);
+ return desc.createImage();
+ }
+
+ protected Label createLabel(final Composite parent, final String text) {
+ final Label label = new Label(parent, SWT.NONE);
+ label.setText(text);
+ return label;
+ }
+
+ private TableViewerColumn createTableViewerColumn(final TableViewer viewer, final String title, final int bound,
+ final int colNumber) {
+ final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE);
+ final TableColumn column = viewerColumn.getColumn();
+ column.setText(title);
+ column.setWidth(bound);
+ column.setResizable(false);
+ column.setMoveable(false);
+ return viewerColumn;
+ }
+
+ @Override
+ protected void performDefaults() {
+ maxProposals.loadDefault();
+ minProbability.loadDefault();
+ }
+
+ @Override
+ public boolean performOk() {
+ maxProposals.store();
+ minProbability.store();
+ return super.performOk();
+ }
+
+ @Override
+ public void setVisible(final boolean visible) {
+ // respond to changes in Java > Editor > Content Assist > Advanced:
+ // this works only one-way. We respond to changes made in JDT but JDT page may show deprecated values.
+ enablement.loadSelection();
+ super.setVisible(visible);
+ }
+
+ @Override
+ public void propertyChange(final PropertyChangeEvent event) {
+ if (event.getProperty().equals(FieldEditor.IS_VALID)) {
+ setValid(maxProposals.isValid() && minProbability.isValid());
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/ModelLabelProvider.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/ModelLabelProvider.java
index 87ce14e..547c57f 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/ModelLabelProvider.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/ModelLabelProvider.java
@@ -67,4 +67,4 @@ public class ModelLabelProvider extends ColumnLabelProvider {
File location = repository.location(opt.get());
return location.exists();
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/PackageFragmentRootLabelProvider.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/PackageFragmentRootLabelProvider.java
index 36e0d82..1262725 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/PackageFragmentRootLabelProvider.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/PackageFragmentRootLabelProvider.java
@@ -29,4 +29,4 @@ public class PackageFragmentRootLabelProvider extends ColumnLabelProvider {
Tuple<ClasspathEntryInfo, ModelArchiveMetadata<?, ?>> e = cast(element);
return e.getSecond().getLocation().getAbsolutePath();
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/VersionLabelProvider.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/VersionLabelProvider.java
index fe9f266..afd75e6 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/VersionLabelProvider.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/preferences/VersionLabelProvider.java
@@ -60,4 +60,4 @@ public class VersionLabelProvider extends ColumnLabelProvider {
}
return true;
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/CallsCompletionModule.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/CallsCompletionModule.java
index 68c893b..f35881e 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/CallsCompletionModule.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/CallsCompletionModule.java
@@ -1,63 +1,63 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.calls.wiring;
-
-import static java.lang.String.format;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.io.File;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.recommenders.internal.completion.rcp.calls.net.IObjectMethodCallsNet;
-import org.eclipse.recommenders.internal.completion.rcp.calls.wiring.ManualModelStoreWiring.CallModelArchiveStore;
-import org.eclipse.recommenders.internal.rcp.models.IModelArchiveStore;
-import org.eclipse.recommenders.internal.rcp.models.store.DefaultModelArchiveStore;
-import org.osgi.framework.FrameworkUtil;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.BindingAnnotation;
-import com.google.inject.Scopes;
-import com.google.inject.TypeLiteral;
-
-public class CallsCompletionModule extends AbstractModule {
-
- public static final String MODEL_VERSION = "0.5";
-
- public static TypeLiteral<IModelArchiveStore<IType, IObjectMethodCallsNet>> STORE = new TypeLiteral<IModelArchiveStore<IType, IObjectMethodCallsNet>>() {
- };
- public static TypeLiteral<DefaultModelArchiveStore<IType, IObjectMethodCallsNet>> STORE_IMPL = new TypeLiteral<DefaultModelArchiveStore<IType, IObjectMethodCallsNet>>() {
- };
-
- @Override
- protected void configure() {
- final IPath stateLocation = Platform.getStateLocation(FrameworkUtil.getBundle(getClass()));
- final File index = new File(stateLocation.toFile(), format("call-models-%s.json", MODEL_VERSION));
- bind(File.class).annotatedWith(CallCompletion.class).toInstance(index);
- bind(STORE).to(CallModelArchiveStore.class).in(Scopes.SINGLETON);
-
- final IPreferenceStore prefStore = CallsCompletionPlugin.getDefault().getPreferenceStore();
- bind(IPreferenceStore.class).annotatedWith(CallCompletion.class).toInstance(prefStore);
- }
-
- @BindingAnnotation
- @Target({ PARAMETER, METHOD })
- @Retention(RUNTIME)
- public static @interface CallCompletion {
- }
-
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.calls.wiring;
+
+import static java.lang.String.format;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.io.File;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.recommenders.internal.completion.rcp.calls.net.IObjectMethodCallsNet;
+import org.eclipse.recommenders.internal.completion.rcp.calls.wiring.ManualModelStoreWiring.CallModelArchiveStore;
+import org.eclipse.recommenders.internal.rcp.models.IModelArchiveStore;
+import org.eclipse.recommenders.internal.rcp.models.store.DefaultModelArchiveStore;
+import org.osgi.framework.FrameworkUtil;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.BindingAnnotation;
+import com.google.inject.Scopes;
+import com.google.inject.TypeLiteral;
+
+public class CallsCompletionModule extends AbstractModule {
+
+ public static final String MODEL_VERSION = "0.5";
+
+ public static TypeLiteral<IModelArchiveStore<IType, IObjectMethodCallsNet>> STORE = new TypeLiteral<IModelArchiveStore<IType, IObjectMethodCallsNet>>() {
+ };
+ public static TypeLiteral<DefaultModelArchiveStore<IType, IObjectMethodCallsNet>> STORE_IMPL = new TypeLiteral<DefaultModelArchiveStore<IType, IObjectMethodCallsNet>>() {
+ };
+
+ @Override
+ protected void configure() {
+ final IPath stateLocation = Platform.getStateLocation(FrameworkUtil.getBundle(getClass()));
+ final File index = new File(stateLocation.toFile(), format("call-models-%s.json", MODEL_VERSION));
+ bind(File.class).annotatedWith(CallCompletion.class).toInstance(index);
+ bind(STORE).to(CallModelArchiveStore.class).in(Scopes.SINGLETON);
+
+ final IPreferenceStore prefStore = CallsCompletionPlugin.getDefault().getPreferenceStore();
+ bind(IPreferenceStore.class).annotatedWith(CallCompletion.class).toInstance(prefStore);
+ }
+
+ @BindingAnnotation
+ @Target({ PARAMETER, METHOD })
+ @Retention(RUNTIME)
+ public static @interface CallCompletion {
+ }
+
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/CallsCompletionPlugin.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/CallsCompletionPlugin.java
index 9d054cd..f118ff9 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/CallsCompletionPlugin.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/CallsCompletionPlugin.java
@@ -1,54 +1,54 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.calls.wiring;
-
-import java.io.IOException;
-
-import org.eclipse.recommenders.injection.InjectionService;
-import org.eclipse.recommenders.utils.rcp.LoggingUtils;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-import com.google.inject.Injector;
-import com.google.inject.Key;
-
-public class CallsCompletionPlugin extends AbstractUIPlugin {
-
- public static final String PLUGIN_ID = "org.eclipse.recommenders.completion.rcp.calls";
-
- private static CallsCompletionPlugin plugin;
-
- public static CallsCompletionPlugin getDefault() {
- return plugin;
- }
-
- @Override
- public void start(final BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- @Override
- public void stop(final BundleContext context) throws Exception {
- closeStore();
- plugin = null;
- super.stop(context);
- }
-
- private void closeStore() {
- try {
- final Injector injector = InjectionService.getInstance().getInjector();
- injector.getInstance(Key.get(CallsCompletionModule.STORE)).close();
- } catch (final IOException e) {
- LoggingUtils.logError(e, this, "Exception while closing dependency store.");
- }
- }
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.calls.wiring;
+
+import java.io.IOException;
+
+import org.eclipse.recommenders.injection.InjectionService;
+import org.eclipse.recommenders.utils.rcp.LoggingUtils;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+import com.google.inject.Injector;
+import com.google.inject.Key;
+
+public class CallsCompletionPlugin extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.recommenders.completion.rcp.calls";
+
+ private static CallsCompletionPlugin plugin;
+
+ public static CallsCompletionPlugin getDefault() {
+ return plugin;
+ }
+
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ closeStore();
+ plugin = null;
+ super.stop(context);
+ }
+
+ private void closeStore() {
+ try {
+ final Injector injector = InjectionService.getInstance().getInjector();
+ injector.getInstance(Key.get(CallsCompletionModule.STORE)).close();
+ } catch (final IOException e) {
+ LoggingUtils.logError(e, this, "Exception while closing dependency store.");
+ }
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/ManualModelStoreWiring.java b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/ManualModelStoreWiring.java
index 18f551b..5e9dacb 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/ManualModelStoreWiring.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.calls/src/org/eclipse/recommenders/internal/completion/rcp/calls/wiring/ManualModelStoreWiring.java
@@ -57,4 +57,4 @@ public class ManualModelStoreWiring {
});
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/pom.xml b/plugins/org.eclipse.recommenders.completion.rcp.chain/pom.xml
index 79391cb..019825c 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/pom.xml
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/pom.xml
@@ -1,21 +1,21 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.plugin</groupId>
- <artifactId>org.eclipse.recommenders.plugin.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.plugin</groupId>
+ <artifactId>org.eclipse.recommenders.plugin.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.completion.rcp.chain</artifactId>
- <packaging>eclipse-plugin</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.completion.rcp.chain</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferencePage.java b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferencePage.java
index f96cb01..8cb1ab2 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferencePage.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.chain/src/org/eclipse/recommenders/internal/completion/rcp/chain/ui/ChainPreferencePage.java
@@ -118,4 +118,4 @@ public class ChainPreferencePage extends org.eclipse.jface.preference.FieldEdito
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.e37/pom.xml b/plugins/org.eclipse.recommenders.completion.rcp.e37/pom.xml
index 4303f14..0ed1447 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.e37/pom.xml
+++ b/plugins/org.eclipse.recommenders.completion.rcp.e37/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.plugin</groupId>
- <artifactId>org.eclipse.recommenders.plugin.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.plugin</groupId>
+ <artifactId>org.eclipse.recommenders.plugin.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.completion.rcp.e37</artifactId>
- <packaging>eclipse-plugin</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.completion.rcp.e37</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/CompilerAstCompletionNodeFinder.java b/plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/CompilerAstCompletionNodeFinder.java
index 06b18b3..76ce82a 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/CompilerAstCompletionNodeFinder.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/CompilerAstCompletionNodeFinder.java
@@ -1,1107 +1,1107 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp;
-
-import static org.eclipse.recommenders.utils.Checks.ensureIsNotNull;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import org.eclipse.jdt.internal.codeassist.complete.CompletionOnFieldType;
-import org.eclipse.jdt.internal.codeassist.complete.CompletionOnLocalName;
-import org.eclipse.jdt.internal.codeassist.complete.CompletionOnMemberAccess;
-import org.eclipse.jdt.internal.codeassist.complete.CompletionOnMessageSend;
-import org.eclipse.jdt.internal.codeassist.complete.CompletionOnQualifiedNameReference;
-import org.eclipse.jdt.internal.codeassist.complete.CompletionOnSingleNameReference;
-import org.eclipse.jdt.internal.compiler.ASTVisitor;
-import org.eclipse.jdt.internal.compiler.ast.AND_AND_Expression;
-import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
-import org.eclipse.jdt.internal.compiler.ast.AnnotationMethodDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.Argument;
-import org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression;
-import org.eclipse.jdt.internal.compiler.ast.ArrayInitializer;
-import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference;
-import org.eclipse.jdt.internal.compiler.ast.ArrayReference;
-import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference;
-import org.eclipse.jdt.internal.compiler.ast.AssertStatement;
-import org.eclipse.jdt.internal.compiler.ast.Assignment;
-import org.eclipse.jdt.internal.compiler.ast.BinaryExpression;
-import org.eclipse.jdt.internal.compiler.ast.Block;
-import org.eclipse.jdt.internal.compiler.ast.BreakStatement;
-import org.eclipse.jdt.internal.compiler.ast.CaseStatement;
-import org.eclipse.jdt.internal.compiler.ast.CastExpression;
-import org.eclipse.jdt.internal.compiler.ast.CharLiteral;
-import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
-import org.eclipse.jdt.internal.compiler.ast.Clinit;
-import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.CompoundAssignment;
-import org.eclipse.jdt.internal.compiler.ast.ConditionalExpression;
-import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.ContinueStatement;
-import org.eclipse.jdt.internal.compiler.ast.DoStatement;
-import org.eclipse.jdt.internal.compiler.ast.DoubleLiteral;
-import org.eclipse.jdt.internal.compiler.ast.EmptyStatement;
-import org.eclipse.jdt.internal.compiler.ast.EqualExpression;
-import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
-import org.eclipse.jdt.internal.compiler.ast.Expression;
-import org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral;
-import org.eclipse.jdt.internal.compiler.ast.FalseLiteral;
-import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.FieldReference;
-import org.eclipse.jdt.internal.compiler.ast.FloatLiteral;
-import org.eclipse.jdt.internal.compiler.ast.ForStatement;
-import org.eclipse.jdt.internal.compiler.ast.ForeachStatement;
-import org.eclipse.jdt.internal.compiler.ast.IfStatement;
-import org.eclipse.jdt.internal.compiler.ast.ImportReference;
-import org.eclipse.jdt.internal.compiler.ast.Initializer;
-import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression;
-import org.eclipse.jdt.internal.compiler.ast.IntLiteral;
-import org.eclipse.jdt.internal.compiler.ast.Javadoc;
-import org.eclipse.jdt.internal.compiler.ast.JavadocAllocationExpression;
-import org.eclipse.jdt.internal.compiler.ast.JavadocArgumentExpression;
-import org.eclipse.jdt.internal.compiler.ast.JavadocArrayQualifiedTypeReference;
-import org.eclipse.jdt.internal.compiler.ast.JavadocArraySingleTypeReference;
-import org.eclipse.jdt.internal.compiler.ast.JavadocFieldReference;
-import org.eclipse.jdt.internal.compiler.ast.JavadocImplicitTypeReference;
-import org.eclipse.jdt.internal.compiler.ast.JavadocMessageSend;
-import org.eclipse.jdt.internal.compiler.ast.JavadocQualifiedTypeReference;
-import org.eclipse.jdt.internal.compiler.ast.JavadocReturnStatement;
-import org.eclipse.jdt.internal.compiler.ast.JavadocSingleNameReference;
-import org.eclipse.jdt.internal.compiler.ast.JavadocSingleTypeReference;
-import org.eclipse.jdt.internal.compiler.ast.LabeledStatement;
-import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.LongLiteral;
-import org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation;
-import org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
-import org.eclipse.jdt.internal.compiler.ast.MessageSend;
-import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation;
-import org.eclipse.jdt.internal.compiler.ast.NullLiteral;
-import org.eclipse.jdt.internal.compiler.ast.OR_OR_Expression;
-import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
-import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
-import org.eclipse.jdt.internal.compiler.ast.PostfixExpression;
-import org.eclipse.jdt.internal.compiler.ast.PrefixExpression;
-import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression;
-import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
-import org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference;
-import org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference;
-import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference;
-import org.eclipse.jdt.internal.compiler.ast.ReturnStatement;
-import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation;
-import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
-import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
-import org.eclipse.jdt.internal.compiler.ast.Statement;
-import org.eclipse.jdt.internal.compiler.ast.StringLiteral;
-import org.eclipse.jdt.internal.compiler.ast.StringLiteralConcatenation;
-import org.eclipse.jdt.internal.compiler.ast.SuperReference;
-import org.eclipse.jdt.internal.compiler.ast.SwitchStatement;
-import org.eclipse.jdt.internal.compiler.ast.SynchronizedStatement;
-import org.eclipse.jdt.internal.compiler.ast.ThisReference;
-import org.eclipse.jdt.internal.compiler.ast.ThrowStatement;
-import org.eclipse.jdt.internal.compiler.ast.TrueLiteral;
-import org.eclipse.jdt.internal.compiler.ast.TryStatement;
-import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
-import org.eclipse.jdt.internal.compiler.ast.UnaryExpression;
-import org.eclipse.jdt.internal.compiler.ast.WhileStatement;
-import org.eclipse.jdt.internal.compiler.ast.Wildcard;
-import org.eclipse.jdt.internal.compiler.lookup.Binding;
-import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
-import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
-import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
-import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
-import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
-import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
-import org.eclipse.jdt.internal.compiler.lookup.VariableBinding;
-import org.eclipse.recommenders.utils.annotations.Provisional;
-
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-@Provisional
-@SuppressWarnings("restriction")
-public class CompilerAstCompletionNodeFinder extends ASTVisitor {
-
- /**
- * The JDT completion node created by the completion completion parser.
- *
- * @see one of org.eclipse.jdt.internal.codeassist.complete
- * @see CompletionOnMessageSend
- * @see CompletionOnQualifiedNameReference
- * @see CompletionOnSingleNameReference
- */
- public Statement completionNode;
-
- public List<Statement> parents = Lists.newArrayList();
-
- /**
- * One of {@link ReturnStatement}, {@link LocalDeclaration}, {@link FieldDeclaration}, {@link MessageSend}, or
- * <code>null</code>
- */
- public Statement completionNodeParent() {
- return parents.isEmpty() ? null : Iterables.getLast(parents);
- }
-
- /**
- * The type of the receiver this completion event was triggered on, e.g, Button b = ...; b.|&lt;ctrl-space&gt; would
- * set {@link #receiverType} to <code>Button</code>.
- */
- public TypeBinding receiverType;
-
- /**
- * The name of the receiver - if it has one. When triggering code completion on <code>b.|&lt;ctrl-space&gt;</code>
- * then {@link #receiverName} is 'b'. However, if code completion has been triggered on an implicit method return
- * value like {@code getB().|&lt;ctrl-space&gt;} then {@link #receiverName} is null.
- * <p>
- * If code completion is triggered on a type like <code>PlatformUI</code> this variable holds the name of the type.
- * <b>NOTE:</b> in the case of single names like <code>PlatformUI|&lt;^Space&gt </code> or
- * <code>varName|&lt;^Space&gt</code> the reveiver type is typically NOT set! Be careful!
- */
- public String receiverName;
-
- /**
- * If {@link #expectsReturnType} is true, this completion request requires the completion to define a new local,
- * i.e., in the case of method calls to have a return value.
- */
- public boolean expectsReturnType;
-
- /**
- * if {@link #expectsReturnType} is true, then this value <b>might</b> hold a type binding of the expected return
- * type. However, this might not be as easy and work in all cases and thus may be <code>null</code> even if
- * {@link #expectsReturnType} is true;
- */
- public TypeBinding expectedReturnType;
-
- /**
- * This field is set whenever a completion is triggered on a type name like 'Button' etc.
- * <p>
- * Example:
- *
- * <pre>
- * void someMethod(){
- * Button|&|&lt;ctrl-space&gt;
- * }
- * </pre>
- */
- public TypeBinding requestedTypeCompletion;
-
- public boolean expectsStaticMember;
-
- /**
- * If the code completion event occurs as a method argument guessing completion (i.e.,
- * b.method(|&lt;ctrl-space&gt;), then {@link IntelligentCompletionContext#enclosingMethodCallSelector} contains the
- * (unresolved and potentially ambiguous) name of the method call enclosing this completion event.
- *
- * <p>
- * Example:
- *
- * <pre>
- * methodCall(|&lt;ctrl-space&gt;) // gives "methodCall"
- * </pre>
- */
- public String enclosingMethodCallSelector;
-
- /**
- * If the code completion event occurs as a method argument guessing as indicated by
- * {@link #enclosingMethodCallSelector} being not <code>null</code>, this field holds the type binding that declares
- * the enclosing method.
- */
- public TypeBinding declaringTypeOfEnclosingMethodCall;
-
- /**
- * If code completion was triggered on an implicit method return value, this field stores the method binding that
- * defined this implicit (and unnamed) local variable.
- * <p>
- * Example;
- *
- * <pre>
- * getX().|&lt;ctrl-space&gt; // evaluates to a binding for method "getX"
- * </pre>
- */
- public MethodBinding receiverDefinedByMethodReturn;
-
- public MethodScope scope;
-
- public final Set<FieldDeclaration> fieldDeclarations = Sets.newHashSet();
- public final Set<LocalDeclaration> localDeclarations = Sets.newHashSet();
-
- public Set<MethodDeclaration> methodDeclarations = Sets.newHashSet();
-
- public void clearState() {
- receiverDefinedByMethodReturn = null;
- completionNode = null;
- declaringTypeOfEnclosingMethodCall = null;
- enclosingMethodCallSelector = null;
- expectedReturnType = null;
- expectsReturnType = false;
- expectsStaticMember = false;
- receiverName = null;
- receiverType = null;
- requestedTypeCompletion = null;
- }
-
- @Override
- public boolean visit(final SingleNameReference singleNameReference, final BlockScope scope) {
- if (singleNameReference instanceof CompletionOnSingleNameReference) {
- final CompletionOnSingleNameReference node = storeCompletionNode(singleNameReference);
- evaluateCompletionOnSingleNameReference(node);
- return false;
- }
- // storeParentNode(singleNameReference);
- return true;
- }
-
- private void storeParentNode(final Statement node) {
- parents.add(node);
- }
-
- @SuppressWarnings("unchecked")
- private <T extends Statement> T storeCompletionNode(final Statement statement) {
- completionNode = statement;
- return (T) statement;
- }
-
- private void evaluateCompletionOnSingleNameReference(final CompletionOnSingleNameReference completion) {
- // XXX this is actually not resolving any binding:
- receiverType = completion.resolvedType;
- setReceiverName(completion.token);
- }
-
- private void setReceiverName(final char[] name) {
- final String s = String.valueOf(name);
- setReceiverName(s);
- }
-
- private void setReceiverName(final String name) {
- receiverName = StringUtils.deleteWhitespace(name);
- }
-
- @Override
- public boolean visit(final QualifiedNameReference qualifiedNameReference, final BlockScope scope) {
- if (qualifiedNameReference instanceof CompletionOnQualifiedNameReference) {
- final CompletionOnQualifiedNameReference node = storeCompletionNode(qualifiedNameReference);
- evaluateCompletionOnQualifiedNameReference(node);
- return false;
- }
- storeParentNode(qualifiedNameReference);
- return true;
- }
-
- private void evaluateCompletionOnQualifiedNameReference(final CompletionOnQualifiedNameReference c) {
- switch (c.binding.kind()) {
- case Binding.VARIABLE:
- case Binding.FIELD:
- case Binding.LOCAL:
- final VariableBinding varBinding = (VariableBinding) c.binding;
- evaluateVariableBindingAsReceiver(varBinding);
- return;
-
- case Binding.TYPE:
- // e.g. PlatformUI.|<ctrl-space>
- final TypeBinding typeBinding = (TypeBinding) c.binding;
- receiverType = typeBinding;
- expectsStaticMember = true;
- return;
- default:
- /**
- * triggering code completion on an err pos like:
- *
- * <pre>
- * b.|&lt;^Space&gt;
- * final Button b = new Button(parent, 0);
- *
- * </pre>
- *
- * TODO is this appropriate? Do we want to handle these events? or just discard error situations?
- */
- // if (c.binding instanceof ProblemBinding) {
- // final ProblemBinding problem = cast(c.binding);
- // receiverName = String.valueOf(problem.name);
- // receiverType = problem.searchType;
- // }
- clearState();
- }
- }
-
- private void evaluateVariableBindingAsReceiver(final VariableBinding binding) {
- ensureIsNotNull(binding);
- setReceiverName(binding.name);
- receiverType = binding.type;
- }
-
- @Override
- public boolean visit(final MessageSend messageSend, final BlockScope scope) {
- if (messageSend instanceof CompletionOnMessageSend) {
- final CompletionOnMessageSend node = storeCompletionNode(messageSend);
- evaluateCompletionOnMessageSend(node);
- return false;
- }
- storeParentNode(messageSend);
- return true;
- }
-
- private boolean doArgumentsContainCompletionNode(final MessageSend messageSend) {
- if (messageSend.arguments == null) {
- return false;
- }
- for (Expression arg : messageSend.arguments) {
- if (arg instanceof CompletionOnQualifiedNameReference) {
- return true;
- }
- }
- return false;
- }
-
- private void evaluateCompletionOnMessageSend(final CompletionOnMessageSend c) {
- declaringTypeOfEnclosingMethodCall = c.actualReceiverType;
- enclosingMethodCallSelector = new String(c.selector);
- expectsReturnType = true;
- }
-
- @Override
- public boolean visit(final FieldReference fieldReference, final BlockScope scope) {
- if (fieldReference instanceof CompletionOnMemberAccess) {
- final CompletionOnMemberAccess node = storeCompletionNode(fieldReference);
- evaluateCompletionOnMemberAccess(node);
- return false;
- }
- storeParentNode(fieldReference);
- return true;
- }
-
- private void evaluateCompletionOnMemberAccess(final CompletionOnMemberAccess c) {
- // what is the actual receiver type we are asked to create a completion
- // for (i.e., the type returned by the members method return type?
- receiverType = c.actualReceiverType;
- // since we are navigating through the API call graph this receiver
- // either is 'this' or has
- // no name.
- if (c.receiver instanceof ThisReference) {
- // NOTE simply calling 'c.isThis()' doesn't work;
- evaluateThisReferenceAsReceiver((ThisReference) c.receiver);
- } else if (c.receiver instanceof MessageSend) {
- evaluteMessageSendAsDefForAnonymousReceiver((MessageSend) c.receiver);
- } else if (c.fieldBinding() != null) {
- // does this happen? When?
- evaluateVariableBindingAsReceiver(c.fieldBinding());
- } else if (c.localVariableBinding() != null) {
- // does this happen? when?
- evaluateVariableBindingAsReceiver(c.localVariableBinding());
- }
- }
-
- private void evaluateThisReferenceAsReceiver(final ThisReference ref) {
- setReceiverName("this");
- receiverType = ref.resolvedType;
- }
-
- /**
- * <pre>
- * public Activator() {
- * b.getLocation().|&lt;ctrl-space&gt;
- * }
- * </pre>
- *
- * @param m
- */
- private void evaluteMessageSendAsDefForAnonymousReceiver(final MessageSend m) {
- if (m.binding != null) {
- receiverDefinedByMethodReturn = m.binding;
- receiverType = m.binding.returnType;
- setReceiverName("");
- }
- }
-
- @Override
- public boolean visit(final LocalDeclaration localDeclaration, final BlockScope scope) {
- if (localDeclaration instanceof CompletionOnLocalName) {
- final CompletionOnLocalName node = storeCompletionNode(localDeclaration);
- evaluateCompletionOnLocalName(node);
- return true;
- } else if (isCompletionOnVariableInitialization(localDeclaration.initialization)) {
- setExpectedReturnType(localDeclaration.binding.type);
- } else {
- // we only add this declaration if it's "complete".
- // Var c = c doesn't make sense, right?
- localDeclarations.add(localDeclaration);
- }
- storeParentNode(localDeclaration);
- return true;
- }
-
- private void evaluateCompletionOnLocalName(final CompletionOnLocalName c) {
- if (c.binding != null) {
- setExpectedReturnType(c.binding.type);
- // TODO this is actually not correct! Need to fix the pattern
- // template stuff which expects receiver type
- // being set!
- receiverType = expectedReturnType;
- }
- setReceiverName(c.name);
- expectsReturnType = true;
- }
-
- @Override
- public boolean visit(final FieldDeclaration fieldDeclaration, final MethodScope scope) {
- if (fieldDeclaration instanceof CompletionOnFieldType) {
- storeCompletionNode(fieldDeclaration);
- return false;
- }
- storeParentNode(fieldDeclaration);
- if (isCompletionOnVariableInitialization(fieldDeclaration.initialization)
- && checkFieldTypeIsKnown(fieldDeclaration)) {
-
- setExpectedReturnType(fieldDeclaration.binding.type);
- } else {
- // we only add this declaration if it's "complete".
- // Var c = c doesn't make sense, right?
- fieldDeclarations.add(fieldDeclaration);
- }
- return true;
- }
-
- /**
- * the field declaration binding may be null in the case of an ill-defined field declaration (that doesn't compile).
- */
- private boolean checkFieldTypeIsKnown(final FieldDeclaration fieldDeclaration) {
- return fieldDeclaration.binding != null;
- }
-
- private boolean isCompletionOnVariableInitialization(final Expression initialization) {
- return initialization instanceof CompletionOnSingleNameReference
- || initialization instanceof CompletionOnQualifiedNameReference
- || initialization instanceof CompletionOnMemberAccess;
- }
-
- public boolean isCompletionNodeFound() {
- return completionNode != null;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
- }
-
- @Override
- public boolean visit(final AllocationExpression allocationExpression, final BlockScope scope) {
- storeParentNode(allocationExpression);
- return true;
- }
-
- @Override
- public boolean visit(final AND_AND_Expression and_and_Expression, final BlockScope scope) {
- storeParentNode(and_and_Expression);
- return true;
- }
-
- @Override
- public boolean visit(final AnnotationMethodDeclaration annotationTypeDeclaration, final ClassScope classScope) {
- return true;
- }
-
- @Override
- public boolean visit(final Argument argument, final BlockScope scope) {
- storeParentNode(argument);
- return true;
- }
-
- @Override
- public boolean visit(final Argument argument, final ClassScope scope) {
- storeParentNode(argument);
- return true;
- }
-
- @Override
- public boolean visit(final ArrayAllocationExpression arrayAllocationExpression, final BlockScope scope) {
- storeParentNode(arrayAllocationExpression);
- return true;
- }
-
- @Override
- public boolean visit(final ArrayInitializer arrayInitializer, final BlockScope scope) {
- storeParentNode(arrayInitializer);
- return true;
- }
-
- @Override
- public boolean visit(final ArrayQualifiedTypeReference arrayQualifiedTypeReference, final BlockScope scope) {
- storeParentNode(arrayQualifiedTypeReference);
- return true;
- }
-
- @Override
- public boolean visit(final ArrayQualifiedTypeReference arrayQualifiedTypeReference, final ClassScope scope) {
- storeParentNode(arrayQualifiedTypeReference);
-
- return true;
- }
-
- @Override
- public boolean visit(final ArrayReference arrayReference, final BlockScope scope) {
- storeParentNode(arrayReference);
- return true;
- }
-
- @Override
- public boolean visit(final ArrayTypeReference arrayTypeReference, final BlockScope scope) {
- storeParentNode(arrayTypeReference);
-
- return true;
- }
-
- @Override
- public boolean visit(final ArrayTypeReference arrayTypeReference, final ClassScope scope) {
- storeParentNode(arrayTypeReference);
- return true;
- }
-
- @Override
- public boolean visit(final AssertStatement assertStatement, final BlockScope scope) {
- storeParentNode(assertStatement);
- return true;
- }
-
- @Override
- public boolean visit(final Assignment assignment, final BlockScope scope) {
- storeCompletionNode(assignment);
- if (assignment.expression instanceof CompletionOnSingleNameReference) {
- return true;
- } else if (assignment.expression instanceof CompletionOnQualifiedNameReference) {
- return true;
- }
- return true;
- }
-
- @Override
- public boolean visit(final BinaryExpression binaryExpression, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final Block block, final BlockScope scope) {
- storeParentNode(block);
- return true;
- }
-
- @Override
- public boolean visit(final BreakStatement breakStatement, final BlockScope scope) {
- storeParentNode(breakStatement);
- return true;
- }
-
- @Override
- public boolean visit(final CaseStatement caseStatement, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final CastExpression castExpression, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final CharLiteral charLiteral, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ClassLiteralAccess classLiteral, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final Clinit clinit, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final CompilationUnitDeclaration compilationUnitDeclaration, final CompilationUnitScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final CompoundAssignment compoundAssignment, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ConditionalExpression conditionalExpression, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ConstructorDeclaration constructorDeclaration, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ContinueStatement continueStatement, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final DoStatement doStatement, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final DoubleLiteral doubleLiteral, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final EmptyStatement emptyStatement, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final EqualExpression equalExpression, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ExplicitConstructorCall explicitConstructor, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ExtendedStringLiteral extendedStringLiteral, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final FalseLiteral falseLiteral, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final FieldReference fieldReference, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final FloatLiteral floatLiteral, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ForeachStatement forStatement, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ForStatement forStatement, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final IfStatement ifStatement, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ImportReference importRef, final CompilationUnitScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final Initializer initializer, final MethodScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final InstanceOfExpression instanceOfExpression, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final IntLiteral intLiteral, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final Javadoc javadoc, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final Javadoc javadoc, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocAllocationExpression expression, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocAllocationExpression expression, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocArgumentExpression expression, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocArgumentExpression expression, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocArrayQualifiedTypeReference typeRef, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocArrayQualifiedTypeReference typeRef, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocArraySingleTypeReference typeRef, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocArraySingleTypeReference typeRef, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocFieldReference fieldRef, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocFieldReference fieldRef, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocImplicitTypeReference implicitTypeReference, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocImplicitTypeReference implicitTypeReference, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocMessageSend messageSend, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocMessageSend messageSend, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocQualifiedTypeReference typeRef, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocQualifiedTypeReference typeRef, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocReturnStatement statement, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocReturnStatement statement, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocSingleNameReference argument, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocSingleNameReference argument, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocSingleTypeReference typeRef, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final JavadocSingleTypeReference typeRef, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final LabeledStatement labeledStatement, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final LongLiteral longLiteral, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final MarkerAnnotation annotation, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final MemberValuePair pair, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final MethodDeclaration methodDeclaration, final ClassScope scope) {
- methodDeclarations.add(methodDeclaration);
- return true;
- }
-
- @Override
- public boolean visit(final StringLiteralConcatenation literal, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final NormalAnnotation annotation, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final NullLiteral nullLiteral, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final OR_OR_Expression or_or_Expression, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference,
- final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference,
- final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ParameterizedSingleTypeReference parameterizedSingleTypeReference, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ParameterizedSingleTypeReference parameterizedSingleTypeReference, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final PostfixExpression postfixExpression, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final PrefixExpression prefixExpression, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final QualifiedAllocationExpression qualifiedAllocationExpression, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final QualifiedNameReference qualifiedNameReference, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final QualifiedSuperReference qualifiedSuperReference, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final QualifiedSuperReference qualifiedSuperReference, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final QualifiedThisReference qualifiedThisReference, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final QualifiedThisReference qualifiedThisReference, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final QualifiedTypeReference qualifiedTypeReference, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final QualifiedTypeReference qualifiedTypeReference, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ReturnStatement returnStatement, final BlockScope scope) {
- if (!isCompletionOnVariableInitialization(returnStatement.expression)) {
- return true;
- }
- if (!(scope.referenceContext() instanceof AbstractMethodDeclaration)) {
- return true;
- }
- final AbstractMethodDeclaration referenceContext = (AbstractMethodDeclaration) scope.referenceContext();
- if (referenceContext.binding == null) {
- return true;
- }
- setExpectedReturnType(referenceContext.binding.returnType);
- parents.add(returnStatement);
-
- return true;
- }
-
- private void setExpectedReturnType(final TypeBinding type) {
- expectedReturnType = type;
- expectsReturnType = true;
- }
-
- @Override
- public boolean visit(final SingleMemberAnnotation annotation, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final SingleNameReference singleNameReference, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final SingleTypeReference singleTypeReference, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final SingleTypeReference singleTypeReference, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final StringLiteral stringLiteral, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final SuperReference superReference, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final SwitchStatement switchStatement, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final SynchronizedStatement synchronizedStatement, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ThisReference thisReference, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ThisReference thisReference, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final ThrowStatement throwStatement, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final TrueLiteral trueLiteral, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final TryStatement tryStatement, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final TypeDeclaration localTypeDeclaration, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final TypeDeclaration memberTypeDeclaration, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final TypeDeclaration typeDeclaration, final CompilationUnitScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final TypeParameter typeParameter, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final TypeParameter typeParameter, final ClassScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final UnaryExpression unaryExpression, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final WhileStatement whileStatement, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final Wildcard wildcard, final BlockScope scope) {
- return true;
- }
-
- @Override
- public boolean visit(final Wildcard wildcard, final ClassScope scope) {
- return true;
- }
-
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp;
+
+import static org.eclipse.recommenders.utils.Checks.ensureIsNotNull;
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.eclipse.jdt.internal.codeassist.complete.CompletionOnFieldType;
+import org.eclipse.jdt.internal.codeassist.complete.CompletionOnLocalName;
+import org.eclipse.jdt.internal.codeassist.complete.CompletionOnMemberAccess;
+import org.eclipse.jdt.internal.codeassist.complete.CompletionOnMessageSend;
+import org.eclipse.jdt.internal.codeassist.complete.CompletionOnQualifiedNameReference;
+import org.eclipse.jdt.internal.codeassist.complete.CompletionOnSingleNameReference;
+import org.eclipse.jdt.internal.compiler.ASTVisitor;
+import org.eclipse.jdt.internal.compiler.ast.AND_AND_Expression;
+import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
+import org.eclipse.jdt.internal.compiler.ast.AnnotationMethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.Argument;
+import org.eclipse.jdt.internal.compiler.ast.ArrayAllocationExpression;
+import org.eclipse.jdt.internal.compiler.ast.ArrayInitializer;
+import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.ArrayReference;
+import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.AssertStatement;
+import org.eclipse.jdt.internal.compiler.ast.Assignment;
+import org.eclipse.jdt.internal.compiler.ast.BinaryExpression;
+import org.eclipse.jdt.internal.compiler.ast.Block;
+import org.eclipse.jdt.internal.compiler.ast.BreakStatement;
+import org.eclipse.jdt.internal.compiler.ast.CaseStatement;
+import org.eclipse.jdt.internal.compiler.ast.CastExpression;
+import org.eclipse.jdt.internal.compiler.ast.CharLiteral;
+import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
+import org.eclipse.jdt.internal.compiler.ast.Clinit;
+import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.CompoundAssignment;
+import org.eclipse.jdt.internal.compiler.ast.ConditionalExpression;
+import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.ContinueStatement;
+import org.eclipse.jdt.internal.compiler.ast.DoStatement;
+import org.eclipse.jdt.internal.compiler.ast.DoubleLiteral;
+import org.eclipse.jdt.internal.compiler.ast.EmptyStatement;
+import org.eclipse.jdt.internal.compiler.ast.EqualExpression;
+import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall;
+import org.eclipse.jdt.internal.compiler.ast.Expression;
+import org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral;
+import org.eclipse.jdt.internal.compiler.ast.FalseLiteral;
+import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.FieldReference;
+import org.eclipse.jdt.internal.compiler.ast.FloatLiteral;
+import org.eclipse.jdt.internal.compiler.ast.ForStatement;
+import org.eclipse.jdt.internal.compiler.ast.ForeachStatement;
+import org.eclipse.jdt.internal.compiler.ast.IfStatement;
+import org.eclipse.jdt.internal.compiler.ast.ImportReference;
+import org.eclipse.jdt.internal.compiler.ast.Initializer;
+import org.eclipse.jdt.internal.compiler.ast.InstanceOfExpression;
+import org.eclipse.jdt.internal.compiler.ast.IntLiteral;
+import org.eclipse.jdt.internal.compiler.ast.Javadoc;
+import org.eclipse.jdt.internal.compiler.ast.JavadocAllocationExpression;
+import org.eclipse.jdt.internal.compiler.ast.JavadocArgumentExpression;
+import org.eclipse.jdt.internal.compiler.ast.JavadocArrayQualifiedTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.JavadocArraySingleTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.JavadocFieldReference;
+import org.eclipse.jdt.internal.compiler.ast.JavadocImplicitTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.JavadocMessageSend;
+import org.eclipse.jdt.internal.compiler.ast.JavadocQualifiedTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.JavadocReturnStatement;
+import org.eclipse.jdt.internal.compiler.ast.JavadocSingleNameReference;
+import org.eclipse.jdt.internal.compiler.ast.JavadocSingleTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.LabeledStatement;
+import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.LongLiteral;
+import org.eclipse.jdt.internal.compiler.ast.MarkerAnnotation;
+import org.eclipse.jdt.internal.compiler.ast.MemberValuePair;
+import org.eclipse.jdt.internal.compiler.ast.MessageSend;
+import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.NormalAnnotation;
+import org.eclipse.jdt.internal.compiler.ast.NullLiteral;
+import org.eclipse.jdt.internal.compiler.ast.OR_OR_Expression;
+import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.PostfixExpression;
+import org.eclipse.jdt.internal.compiler.ast.PrefixExpression;
+import org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression;
+import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference;
+import org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference;
+import org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference;
+import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.ReturnStatement;
+import org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation;
+import org.eclipse.jdt.internal.compiler.ast.SingleNameReference;
+import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
+import org.eclipse.jdt.internal.compiler.ast.Statement;
+import org.eclipse.jdt.internal.compiler.ast.StringLiteral;
+import org.eclipse.jdt.internal.compiler.ast.StringLiteralConcatenation;
+import org.eclipse.jdt.internal.compiler.ast.SuperReference;
+import org.eclipse.jdt.internal.compiler.ast.SwitchStatement;
+import org.eclipse.jdt.internal.compiler.ast.SynchronizedStatement;
+import org.eclipse.jdt.internal.compiler.ast.ThisReference;
+import org.eclipse.jdt.internal.compiler.ast.ThrowStatement;
+import org.eclipse.jdt.internal.compiler.ast.TrueLiteral;
+import org.eclipse.jdt.internal.compiler.ast.TryStatement;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
+import org.eclipse.jdt.internal.compiler.ast.UnaryExpression;
+import org.eclipse.jdt.internal.compiler.ast.WhileStatement;
+import org.eclipse.jdt.internal.compiler.ast.Wildcard;
+import org.eclipse.jdt.internal.compiler.lookup.Binding;
+import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
+import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
+import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
+import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
+import org.eclipse.jdt.internal.compiler.lookup.MethodScope;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+import org.eclipse.jdt.internal.compiler.lookup.VariableBinding;
+import org.eclipse.recommenders.utils.annotations.Provisional;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+@Provisional
+@SuppressWarnings("restriction")
+public class CompilerAstCompletionNodeFinder extends ASTVisitor {
+
+ /**
+ * The JDT completion node created by the completion completion parser.
+ *
+ * @see one of org.eclipse.jdt.internal.codeassist.complete
+ * @see CompletionOnMessageSend
+ * @see CompletionOnQualifiedNameReference
+ * @see CompletionOnSingleNameReference
+ */
+ public Statement completionNode;
+
+ public List<Statement> parents = Lists.newArrayList();
+
+ /**
+ * One of {@link ReturnStatement}, {@link LocalDeclaration}, {@link FieldDeclaration}, {@link MessageSend}, or
+ * <code>null</code>
+ */
+ public Statement completionNodeParent() {
+ return parents.isEmpty() ? null : Iterables.getLast(parents);
+ }
+
+ /**
+ * The type of the receiver this completion event was triggered on, e.g, Button b = ...; b.|&lt;ctrl-space&gt; would
+ * set {@link #receiverType} to <code>Button</code>.
+ */
+ public TypeBinding receiverType;
+
+ /**
+ * The name of the receiver - if it has one. When triggering code completion on <code>b.|&lt;ctrl-space&gt;</code>
+ * then {@link #receiverName} is 'b'. However, if code completion has been triggered on an implicit method return
+ * value like {@code getB().|&lt;ctrl-space&gt;} then {@link #receiverName} is null.
+ * <p>
+ * If code completion is triggered on a type like <code>PlatformUI</code> this variable holds the name of the type.
+ * <b>NOTE:</b> in the case of single names like <code>PlatformUI|&lt;^Space&gt </code> or
+ * <code>varName|&lt;^Space&gt</code> the reveiver type is typically NOT set! Be careful!
+ */
+ public String receiverName;
+
+ /**
+ * If {@link #expectsReturnType} is true, this completion request requires the completion to define a new local,
+ * i.e., in the case of method calls to have a return value.
+ */
+ public boolean expectsReturnType;
+
+ /**
+ * if {@link #expectsReturnType} is true, then this value <b>might</b> hold a type binding of the expected return
+ * type. However, this might not be as easy and work in all cases and thus may be <code>null</code> even if
+ * {@link #expectsReturnType} is true;
+ */
+ public TypeBinding expectedReturnType;
+
+ /**
+ * This field is set whenever a completion is triggered on a type name like 'Button' etc.
+ * <p>
+ * Example:
+ *
+ * <pre>
+ * void someMethod(){
+ * Button|&|&lt;ctrl-space&gt;
+ * }
+ * </pre>
+ */
+ public TypeBinding requestedTypeCompletion;
+
+ public boolean expectsStaticMember;
+
+ /**
+ * If the code completion event occurs as a method argument guessing completion (i.e.,
+ * b.method(|&lt;ctrl-space&gt;), then {@link IntelligentCompletionContext#enclosingMethodCallSelector} contains the
+ * (unresolved and potentially ambiguous) name of the method call enclosing this completion event.
+ *
+ * <p>
+ * Example:
+ *
+ * <pre>
+ * methodCall(|&lt;ctrl-space&gt;) // gives "methodCall"
+ * </pre>
+ */
+ public String enclosingMethodCallSelector;
+
+ /**
+ * If the code completion event occurs as a method argument guessing as indicated by
+ * {@link #enclosingMethodCallSelector} being not <code>null</code>, this field holds the type binding that declares
+ * the enclosing method.
+ */
+ public TypeBinding declaringTypeOfEnclosingMethodCall;
+
+ /**
+ * If code completion was triggered on an implicit method return value, this field stores the method binding that
+ * defined this implicit (and unnamed) local variable.
+ * <p>
+ * Example;
+ *
+ * <pre>
+ * getX().|&lt;ctrl-space&gt; // evaluates to a binding for method "getX"
+ * </pre>
+ */
+ public MethodBinding receiverDefinedByMethodReturn;
+
+ public MethodScope scope;
+
+ public final Set<FieldDeclaration> fieldDeclarations = Sets.newHashSet();
+ public final Set<LocalDeclaration> localDeclarations = Sets.newHashSet();
+
+ public Set<MethodDeclaration> methodDeclarations = Sets.newHashSet();
+
+ public void clearState() {
+ receiverDefinedByMethodReturn = null;
+ completionNode = null;
+ declaringTypeOfEnclosingMethodCall = null;
+ enclosingMethodCallSelector = null;
+ expectedReturnType = null;
+ expectsReturnType = false;
+ expectsStaticMember = false;
+ receiverName = null;
+ receiverType = null;
+ requestedTypeCompletion = null;
+ }
+
+ @Override
+ public boolean visit(final SingleNameReference singleNameReference, final BlockScope scope) {
+ if (singleNameReference instanceof CompletionOnSingleNameReference) {
+ final CompletionOnSingleNameReference node = storeCompletionNode(singleNameReference);
+ evaluateCompletionOnSingleNameReference(node);
+ return false;
+ }
+ // storeParentNode(singleNameReference);
+ return true;
+ }
+
+ private void storeParentNode(final Statement node) {
+ parents.add(node);
+ }
+
+ @SuppressWarnings("unchecked")
+ private <T extends Statement> T storeCompletionNode(final Statement statement) {
+ completionNode = statement;
+ return (T) statement;
+ }
+
+ private void evaluateCompletionOnSingleNameReference(final CompletionOnSingleNameReference completion) {
+ // XXX this is actually not resolving any binding:
+ receiverType = completion.resolvedType;
+ setReceiverName(completion.token);
+ }
+
+ private void setReceiverName(final char[] name) {
+ final String s = String.valueOf(name);
+ setReceiverName(s);
+ }
+
+ private void setReceiverName(final String name) {
+ receiverName = StringUtils.deleteWhitespace(name);
+ }
+
+ @Override
+ public boolean visit(final QualifiedNameReference qualifiedNameReference, final BlockScope scope) {
+ if (qualifiedNameReference instanceof CompletionOnQualifiedNameReference) {
+ final CompletionOnQualifiedNameReference node = storeCompletionNode(qualifiedNameReference);
+ evaluateCompletionOnQualifiedNameReference(node);
+ return false;
+ }
+ storeParentNode(qualifiedNameReference);
+ return true;
+ }
+
+ private void evaluateCompletionOnQualifiedNameReference(final CompletionOnQualifiedNameReference c) {
+ switch (c.binding.kind()) {
+ case Binding.VARIABLE:
+ case Binding.FIELD:
+ case Binding.LOCAL:
+ final VariableBinding varBinding = (VariableBinding) c.binding;
+ evaluateVariableBindingAsReceiver(varBinding);
+ return;
+
+ case Binding.TYPE:
+ // e.g. PlatformUI.|<ctrl-space>
+ final TypeBinding typeBinding = (TypeBinding) c.binding;
+ receiverType = typeBinding;
+ expectsStaticMember = true;
+ return;
+ default:
+ /**
+ * triggering code completion on an err pos like:
+ *
+ * <pre>
+ * b.|&lt;^Space&gt;
+ * final Button b = new Button(parent, 0);
+ *
+ * </pre>
+ *
+ * TODO is this appropriate? Do we want to handle these events? or just discard error situations?
+ */
+ // if (c.binding instanceof ProblemBinding) {
+ // final ProblemBinding problem = cast(c.binding);
+ // receiverName = String.valueOf(problem.name);
+ // receiverType = problem.searchType;
+ // }
+ clearState();
+ }
+ }
+
+ private void evaluateVariableBindingAsReceiver(final VariableBinding binding) {
+ ensureIsNotNull(binding);
+ setReceiverName(binding.name);
+ receiverType = binding.type;
+ }
+
+ @Override
+ public boolean visit(final MessageSend messageSend, final BlockScope scope) {
+ if (messageSend instanceof CompletionOnMessageSend) {
+ final CompletionOnMessageSend node = storeCompletionNode(messageSend);
+ evaluateCompletionOnMessageSend(node);
+ return false;
+ }
+ storeParentNode(messageSend);
+ return true;
+ }
+
+ private boolean doArgumentsContainCompletionNode(final MessageSend messageSend) {
+ if (messageSend.arguments == null) {
+ return false;
+ }
+ for (Expression arg : messageSend.arguments) {
+ if (arg instanceof CompletionOnQualifiedNameReference) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void evaluateCompletionOnMessageSend(final CompletionOnMessageSend c) {
+ declaringTypeOfEnclosingMethodCall = c.actualReceiverType;
+ enclosingMethodCallSelector = new String(c.selector);
+ expectsReturnType = true;
+ }
+
+ @Override
+ public boolean visit(final FieldReference fieldReference, final BlockScope scope) {
+ if (fieldReference instanceof CompletionOnMemberAccess) {
+ final CompletionOnMemberAccess node = storeCompletionNode(fieldReference);
+ evaluateCompletionOnMemberAccess(node);
+ return false;
+ }
+ storeParentNode(fieldReference);
+ return true;
+ }
+
+ private void evaluateCompletionOnMemberAccess(final CompletionOnMemberAccess c) {
+ // what is the actual receiver type we are asked to create a completion
+ // for (i.e., the type returned by the members method return type?
+ receiverType = c.actualReceiverType;
+ // since we are navigating through the API call graph this receiver
+ // either is 'this' or has
+ // no name.
+ if (c.receiver instanceof ThisReference) {
+ // NOTE simply calling 'c.isThis()' doesn't work;
+ evaluateThisReferenceAsReceiver((ThisReference) c.receiver);
+ } else if (c.receiver instanceof MessageSend) {
+ evaluteMessageSendAsDefForAnonymousReceiver((MessageSend) c.receiver);
+ } else if (c.fieldBinding() != null) {
+ // does this happen? When?
+ evaluateVariableBindingAsReceiver(c.fieldBinding());
+ } else if (c.localVariableBinding() != null) {
+ // does this happen? when?
+ evaluateVariableBindingAsReceiver(c.localVariableBinding());
+ }
+ }
+
+ private void evaluateThisReferenceAsReceiver(final ThisReference ref) {
+ setReceiverName("this");
+ receiverType = ref.resolvedType;
+ }
+
+ /**
+ * <pre>
+ * public Activator() {
+ * b.getLocation().|&lt;ctrl-space&gt;
+ * }
+ * </pre>
+ *
+ * @param m
+ */
+ private void evaluteMessageSendAsDefForAnonymousReceiver(final MessageSend m) {
+ if (m.binding != null) {
+ receiverDefinedByMethodReturn = m.binding;
+ receiverType = m.binding.returnType;
+ setReceiverName("");
+ }
+ }
+
+ @Override
+ public boolean visit(final LocalDeclaration localDeclaration, final BlockScope scope) {
+ if (localDeclaration instanceof CompletionOnLocalName) {
+ final CompletionOnLocalName node = storeCompletionNode(localDeclaration);
+ evaluateCompletionOnLocalName(node);
+ return true;
+ } else if (isCompletionOnVariableInitialization(localDeclaration.initialization)) {
+ setExpectedReturnType(localDeclaration.binding.type);
+ } else {
+ // we only add this declaration if it's "complete".
+ // Var c = c doesn't make sense, right?
+ localDeclarations.add(localDeclaration);
+ }
+ storeParentNode(localDeclaration);
+ return true;
+ }
+
+ private void evaluateCompletionOnLocalName(final CompletionOnLocalName c) {
+ if (c.binding != null) {
+ setExpectedReturnType(c.binding.type);
+ // TODO this is actually not correct! Need to fix the pattern
+ // template stuff which expects receiver type
+ // being set!
+ receiverType = expectedReturnType;
+ }
+ setReceiverName(c.name);
+ expectsReturnType = true;
+ }
+
+ @Override
+ public boolean visit(final FieldDeclaration fieldDeclaration, final MethodScope scope) {
+ if (fieldDeclaration instanceof CompletionOnFieldType) {
+ storeCompletionNode(fieldDeclaration);
+ return false;
+ }
+ storeParentNode(fieldDeclaration);
+ if (isCompletionOnVariableInitialization(fieldDeclaration.initialization)
+ && checkFieldTypeIsKnown(fieldDeclaration)) {
+
+ setExpectedReturnType(fieldDeclaration.binding.type);
+ } else {
+ // we only add this declaration if it's "complete".
+ // Var c = c doesn't make sense, right?
+ fieldDeclarations.add(fieldDeclaration);
+ }
+ return true;
+ }
+
+ /**
+ * the field declaration binding may be null in the case of an ill-defined field declaration (that doesn't compile).
+ */
+ private boolean checkFieldTypeIsKnown(final FieldDeclaration fieldDeclaration) {
+ return fieldDeclaration.binding != null;
+ }
+
+ private boolean isCompletionOnVariableInitialization(final Expression initialization) {
+ return initialization instanceof CompletionOnSingleNameReference
+ || initialization instanceof CompletionOnQualifiedNameReference
+ || initialization instanceof CompletionOnMemberAccess;
+ }
+
+ public boolean isCompletionNodeFound() {
+ return completionNode != null;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+
+ @Override
+ public boolean visit(final AllocationExpression allocationExpression, final BlockScope scope) {
+ storeParentNode(allocationExpression);
+ return true;
+ }
+
+ @Override
+ public boolean visit(final AND_AND_Expression and_and_Expression, final BlockScope scope) {
+ storeParentNode(and_and_Expression);
+ return true;
+ }
+
+ @Override
+ public boolean visit(final AnnotationMethodDeclaration annotationTypeDeclaration, final ClassScope classScope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final Argument argument, final BlockScope scope) {
+ storeParentNode(argument);
+ return true;
+ }
+
+ @Override
+ public boolean visit(final Argument argument, final ClassScope scope) {
+ storeParentNode(argument);
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ArrayAllocationExpression arrayAllocationExpression, final BlockScope scope) {
+ storeParentNode(arrayAllocationExpression);
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ArrayInitializer arrayInitializer, final BlockScope scope) {
+ storeParentNode(arrayInitializer);
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ArrayQualifiedTypeReference arrayQualifiedTypeReference, final BlockScope scope) {
+ storeParentNode(arrayQualifiedTypeReference);
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ArrayQualifiedTypeReference arrayQualifiedTypeReference, final ClassScope scope) {
+ storeParentNode(arrayQualifiedTypeReference);
+
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ArrayReference arrayReference, final BlockScope scope) {
+ storeParentNode(arrayReference);
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ArrayTypeReference arrayTypeReference, final BlockScope scope) {
+ storeParentNode(arrayTypeReference);
+
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ArrayTypeReference arrayTypeReference, final ClassScope scope) {
+ storeParentNode(arrayTypeReference);
+ return true;
+ }
+
+ @Override
+ public boolean visit(final AssertStatement assertStatement, final BlockScope scope) {
+ storeParentNode(assertStatement);
+ return true;
+ }
+
+ @Override
+ public boolean visit(final Assignment assignment, final BlockScope scope) {
+ storeCompletionNode(assignment);
+ if (assignment.expression instanceof CompletionOnSingleNameReference) {
+ return true;
+ } else if (assignment.expression instanceof CompletionOnQualifiedNameReference) {
+ return true;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean visit(final BinaryExpression binaryExpression, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final Block block, final BlockScope scope) {
+ storeParentNode(block);
+ return true;
+ }
+
+ @Override
+ public boolean visit(final BreakStatement breakStatement, final BlockScope scope) {
+ storeParentNode(breakStatement);
+ return true;
+ }
+
+ @Override
+ public boolean visit(final CaseStatement caseStatement, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final CastExpression castExpression, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final CharLiteral charLiteral, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ClassLiteralAccess classLiteral, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final Clinit clinit, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final CompilationUnitDeclaration compilationUnitDeclaration, final CompilationUnitScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final CompoundAssignment compoundAssignment, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ConditionalExpression conditionalExpression, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ConstructorDeclaration constructorDeclaration, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ContinueStatement continueStatement, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final DoStatement doStatement, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final DoubleLiteral doubleLiteral, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final EmptyStatement emptyStatement, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final EqualExpression equalExpression, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ExplicitConstructorCall explicitConstructor, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ExtendedStringLiteral extendedStringLiteral, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final FalseLiteral falseLiteral, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final FieldReference fieldReference, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final FloatLiteral floatLiteral, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ForeachStatement forStatement, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ForStatement forStatement, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final IfStatement ifStatement, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ImportReference importRef, final CompilationUnitScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final Initializer initializer, final MethodScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final InstanceOfExpression instanceOfExpression, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final IntLiteral intLiteral, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final Javadoc javadoc, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final Javadoc javadoc, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocAllocationExpression expression, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocAllocationExpression expression, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocArgumentExpression expression, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocArgumentExpression expression, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocArrayQualifiedTypeReference typeRef, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocArrayQualifiedTypeReference typeRef, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocArraySingleTypeReference typeRef, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocArraySingleTypeReference typeRef, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocFieldReference fieldRef, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocFieldReference fieldRef, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocImplicitTypeReference implicitTypeReference, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocImplicitTypeReference implicitTypeReference, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocMessageSend messageSend, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocMessageSend messageSend, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocQualifiedTypeReference typeRef, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocQualifiedTypeReference typeRef, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocReturnStatement statement, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocReturnStatement statement, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocSingleNameReference argument, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocSingleNameReference argument, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocSingleTypeReference typeRef, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final JavadocSingleTypeReference typeRef, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final LabeledStatement labeledStatement, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final LongLiteral longLiteral, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final MarkerAnnotation annotation, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final MemberValuePair pair, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final MethodDeclaration methodDeclaration, final ClassScope scope) {
+ methodDeclarations.add(methodDeclaration);
+ return true;
+ }
+
+ @Override
+ public boolean visit(final StringLiteralConcatenation literal, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final NormalAnnotation annotation, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final NullLiteral nullLiteral, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final OR_OR_Expression or_or_Expression, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference,
+ final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ParameterizedQualifiedTypeReference parameterizedQualifiedTypeReference,
+ final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ParameterizedSingleTypeReference parameterizedSingleTypeReference, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ParameterizedSingleTypeReference parameterizedSingleTypeReference, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final PostfixExpression postfixExpression, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final PrefixExpression prefixExpression, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final QualifiedAllocationExpression qualifiedAllocationExpression, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final QualifiedNameReference qualifiedNameReference, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final QualifiedSuperReference qualifiedSuperReference, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final QualifiedSuperReference qualifiedSuperReference, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final QualifiedThisReference qualifiedThisReference, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final QualifiedThisReference qualifiedThisReference, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final QualifiedTypeReference qualifiedTypeReference, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final QualifiedTypeReference qualifiedTypeReference, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ReturnStatement returnStatement, final BlockScope scope) {
+ if (!isCompletionOnVariableInitialization(returnStatement.expression)) {
+ return true;
+ }
+ if (!(scope.referenceContext() instanceof AbstractMethodDeclaration)) {
+ return true;
+ }
+ final AbstractMethodDeclaration referenceContext = (AbstractMethodDeclaration) scope.referenceContext();
+ if (referenceContext.binding == null) {
+ return true;
+ }
+ setExpectedReturnType(referenceContext.binding.returnType);
+ parents.add(returnStatement);
+
+ return true;
+ }
+
+ private void setExpectedReturnType(final TypeBinding type) {
+ expectedReturnType = type;
+ expectsReturnType = true;
+ }
+
+ @Override
+ public boolean visit(final SingleMemberAnnotation annotation, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final SingleNameReference singleNameReference, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final SingleTypeReference singleTypeReference, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final SingleTypeReference singleTypeReference, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final StringLiteral stringLiteral, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final SuperReference superReference, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final SwitchStatement switchStatement, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final SynchronizedStatement synchronizedStatement, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ThisReference thisReference, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ThisReference thisReference, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final ThrowStatement throwStatement, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final TrueLiteral trueLiteral, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final TryStatement tryStatement, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final TypeDeclaration localTypeDeclaration, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final TypeDeclaration memberTypeDeclaration, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final TypeDeclaration typeDeclaration, final CompilationUnitScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final TypeParameter typeParameter, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final TypeParameter typeParameter, final ClassScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final UnaryExpression unaryExpression, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final WhileStatement whileStatement, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final Wildcard wildcard, final BlockScope scope) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(final Wildcard wildcard, final ClassScope scope) {
+ return true;
+ }
+
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/E37GuiceModule.java b/plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/E37GuiceModule.java
index e6bd5a0..49c2508 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/E37GuiceModule.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/E37GuiceModule.java
@@ -1,26 +1,26 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp;
-
-import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContext;
-import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContextFactory;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.assistedinject.FactoryModuleBuilder;
-
-public class E37GuiceModule extends AbstractModule {
-
- @Override
- protected void configure() {
- install(new FactoryModuleBuilder().implement(IRecommendersCompletionContext.class,
- RecommendersCompletionContext.class).build(IRecommendersCompletionContextFactory.class));
- }
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp;
+
+import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContext;
+import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContextFactory;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.assistedinject.FactoryModuleBuilder;
+
+public class E37GuiceModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ install(new FactoryModuleBuilder().implement(IRecommendersCompletionContext.class,
+ RecommendersCompletionContext.class).build(IRecommendersCompletionContextFactory.class));
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/IntelligentCompletionProposalCollector.java b/plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/IntelligentCompletionProposalCollector.java
index 39ed254..8b3b399 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/IntelligentCompletionProposalCollector.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.e37/src/org/eclipse/recommenders/internal/completion/rcp/IntelligentCompletionProposalCollector.java
@@ -1,41 +1,41 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp;
-
-import org.eclipse.jdt.core.CompletionProposal;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.ui.text.java.CompletionProposalCollector;
-import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
-
-/**
- * Used to convert a {@link CompletionProposal} to an
- * {@link IJavaCompletionProposal}. Therefore it raises the visibility of
- * {@link #createJavaCompletionProposal(CompletionProposal)} from protected to
- * public.
- *
- */
-@Deprecated
-public final class IntelligentCompletionProposalCollector extends CompletionProposalCollector {
-
- public IntelligentCompletionProposalCollector(final ICompilationUnit cu) {
- super(cu);
- }
-
- /**
- * Used to create {@link IJavaCompletionProposal}s from standard
- * {@link CompletionProposal} s. Overridden to increase visibility to
- * public.
- */
- @Override
- public IJavaCompletionProposal createJavaCompletionProposal(final CompletionProposal proposal) {
- return super.createJavaCompletionProposal(proposal);
- }
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp;
+
+import org.eclipse.jdt.core.CompletionProposal;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.ui.text.java.CompletionProposalCollector;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
+
+/**
+ * Used to convert a {@link CompletionProposal} to an
+ * {@link IJavaCompletionProposal}. Therefore it raises the visibility of
+ * {@link #createJavaCompletionProposal(CompletionProposal)} from protected to
+ * public.
+ *
+ */
+@Deprecated
+public final class IntelligentCompletionProposalCollector extends CompletionProposalCollector {
+
+ public IntelligentCompletionProposalCollector(final ICompilationUnit cu) {
+ super(cu);
+ }
+
+ /**
+ * Used to create {@link IJavaCompletionProposal}s from standard
+ * {@link CompletionProposal} s. Overridden to increase visibility to
+ * public.
+ */
+ @Override
+ public IJavaCompletionProposal createJavaCompletionProposal(final CompletionProposal proposal) {
+ return super.createJavaCompletionProposal(proposal);
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.e38/pom.xml b/plugins/org.eclipse.recommenders.completion.rcp.e38/pom.xml
index 5af90f5..84745aa 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.e38/pom.xml
+++ b/plugins/org.eclipse.recommenders.completion.rcp.e38/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.plugin</groupId>
- <artifactId>org.eclipse.recommenders.plugin.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.plugin</groupId>
+ <artifactId>org.eclipse.recommenders.plugin.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.completion.rcp.e38</artifactId>
- <packaging>eclipse-plugin</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.completion.rcp.e38</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.e38/src/org/eclipse/recommenders/internal/completion/rcp/E38GuiceModule.java b/plugins/org.eclipse.recommenders.completion.rcp.e38/src/org/eclipse/recommenders/internal/completion/rcp/E38GuiceModule.java
index e766c2f..6b27cf0 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.e38/src/org/eclipse/recommenders/internal/completion/rcp/E38GuiceModule.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.e38/src/org/eclipse/recommenders/internal/completion/rcp/E38GuiceModule.java
@@ -1,26 +1,26 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp;
-
-import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContext;
-import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContextFactory;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.assistedinject.FactoryModuleBuilder;
-
-public class E38GuiceModule extends AbstractModule {
-
- @Override
- protected void configure() {
- install(new FactoryModuleBuilder().implement(IRecommendersCompletionContext.class,
- RecommendersCompletionContext.class).build(IRecommendersCompletionContextFactory.class));
- }
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp;
+
+import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContext;
+import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContextFactory;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.assistedinject.FactoryModuleBuilder;
+
+public class E38GuiceModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ install(new FactoryModuleBuilder().implement(IRecommendersCompletionContext.class,
+ RecommendersCompletionContext.class).build(IRecommendersCompletionContextFactory.class));
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.overrides/plugin.xml b/plugins/org.eclipse.recommenders.completion.rcp.overrides/plugin.xml
index f36a497..769cf39 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.overrides/plugin.xml
+++ b/plugins/org.eclipse.recommenders.completion.rcp.overrides/plugin.xml
@@ -1,30 +1,30 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.recommenders.injection.modules">
- <module
- class="org.eclipse.recommenders.internal.completion.rcp.overrides.OverridesModule">
- </module>
- </extension>
- <extension
- id="org.eclipse.recommenders.rcp.category.completion.overrides"
- name="Code Recommenders Overrides Proposals"
- point="org.eclipse.jdt.ui.javaCompletionProposalComputer">
- <javaCompletionProposalComputer
- activate="true"
- categoryId="org.eclipse.recommenders.rcp.category.completion"
- class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.overrides.OverridesCompletionProposalComputer">
- </javaCompletionProposalComputer>
- </extension>
- <extension
- point="org.eclipse.recommenders.completion.rcp.sessionprocessors">
- <processor
- class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.overrides.OverridesSessionProcessor"
- icon="icons/obj16/overrides.png"
- id="org.eclipse.recommenders.completion.rcp.overrides.sessionprocessor"
- name="Overrides Completion Processor">
- </processor>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.recommenders.injection.modules">
+ <module
+ class="org.eclipse.recommenders.internal.completion.rcp.overrides.OverridesModule">
+ </module>
+ </extension>
+ <extension
+ id="org.eclipse.recommenders.rcp.category.completion.overrides"
+ name="Code Recommenders Overrides Proposals"
+ point="org.eclipse.jdt.ui.javaCompletionProposalComputer">
+ <javaCompletionProposalComputer
+ activate="true"
+ categoryId="org.eclipse.recommenders.rcp.category.completion"
+ class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.overrides.OverridesCompletionProposalComputer">
+ </javaCompletionProposalComputer>
+ </extension>
+ <extension
+ point="org.eclipse.recommenders.completion.rcp.sessionprocessors">
+ <processor
+ class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.overrides.OverridesSessionProcessor"
+ icon="icons/obj16/overrides.png"
+ id="org.eclipse.recommenders.completion.rcp.overrides.sessionprocessor"
+ name="Overrides Completion Processor">
+ </processor>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.overrides/pom.xml b/plugins/org.eclipse.recommenders.completion.rcp.overrides/pom.xml
index df4f179..88ebfa4 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.overrides/pom.xml
+++ b/plugins/org.eclipse.recommenders.completion.rcp.overrides/pom.xml
@@ -1,22 +1,22 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.plugin</groupId>
- <artifactId>org.eclipse.recommenders.plugin.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.plugin</groupId>
+ <artifactId>org.eclipse.recommenders.plugin.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.completion.rcp.overrides</artifactId>
- <packaging>eclipse-plugin</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.completion.rcp.overrides</artifactId>
+ <packaging>eclipse-plugin</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ClassOverridesNetwork.java b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ClassOverridesNetwork.java
index f7d9ac8..79f9c1a 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ClassOverridesNetwork.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ClassOverridesNetwork.java
@@ -1,120 +1,120 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.overrides;
-
-import static java.lang.String.format;
-import static org.eclipse.recommenders.utils.Checks.ensureEquals;
-
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.eclipse.recommenders.jayes.BayesNet;
-import org.eclipse.recommenders.jayes.BayesNode;
-import org.eclipse.recommenders.jayes.inference.junctionTree.JunctionTreeAlgorithm;
-import org.eclipse.recommenders.utils.Tuple;
-import org.eclipse.recommenders.utils.names.IMethodName;
-import org.eclipse.recommenders.utils.names.ITypeName;
-import org.eclipse.recommenders.utils.names.VmMethodName;
-
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-public class ClassOverridesNetwork {
-
- private final ITypeName typeName;
-
- private final List<BayesNode> methodNodes;
-
- private final JunctionTreeAlgorithm junctionTreeAlgorithm;
-
- private HashMap<IMethodName, BayesNode> methodNameMapping;
-
- protected ClassOverridesNetwork(final ITypeName typeName, final BayesNet network, final BayesNode patternNode,
- final List<BayesNode> methodNodes) {
- this.typeName = typeName;
- this.methodNodes = methodNodes;
- junctionTreeAlgorithm = new JunctionTreeAlgorithm();
- junctionTreeAlgorithm.setNetwork(network);
- createMethodNameMapping();
- }
-
- private void createMethodNameMapping() {
- methodNameMapping = Maps.newHashMap();
- for (final BayesNode methodNode : methodNodes) {
- methodNameMapping.put(VmMethodName.get(methodNode.getName()), methodNode);
- }
- }
-
- public void clearEvidence() {
- junctionTreeAlgorithm.setEvidence(new HashMap<BayesNode, String>());
- }
-
- @Override
- public String toString() {
- return format("Model for '%s'", typeName);
- }
-
- public void observeMethodNode(final IMethodName methodName) {
- final BayesNode methodNode = methodNameMapping.get(methodName);
- if (methodNode != null) {
- junctionTreeAlgorithm.addEvidence(methodNode, "true");
- }
- }
-
- public SortedSet<Tuple<IMethodName, Double>> getRecommendedMethodOverrides(final double minProbability) {
- final TreeSet<Tuple<IMethodName, Double>> recommendations = createSortedSetForMethodRecommendations();
- for (final BayesNode node : methodNodes) {
- if (junctionTreeAlgorithm.getEvidence().containsKey(node)) {
- continue;
- }
- final double probability = junctionTreeAlgorithm.getBeliefs(node)[0];
- if (probability < minProbability) {
- continue;
- }
- final IMethodName method = VmMethodName.get(node.getName());
- final Tuple<IMethodName, Double> item = Tuple.newTuple(method, probability);
- recommendations.add(item);
- }
- return recommendations;
- }
-
- public SortedSet<Tuple<IMethodName, Double>> getRecommendedMethodOverrides(final double minProbabilityThreshold,
- final int maxNumberOfRecommendations) {
- final SortedSet<Tuple<IMethodName, Double>> recommendations = getRecommendedMethodOverrides(minProbabilityThreshold);
- if (recommendations.size() <= maxNumberOfRecommendations) {
- return recommendations;
- }
- // need to remove smaller items:
- final Tuple<IMethodName, Double> firstExcludedRecommendation = Iterables.get(recommendations,
- maxNumberOfRecommendations);
- final SortedSet<Tuple<IMethodName, Double>> res = recommendations.headSet(firstExcludedRecommendation);
- ensureEquals(res.size(), maxNumberOfRecommendations,
- "filter op did not return expected number of compilationUnits2recommendationsIndex");
- return res;
- }
-
- public static TreeSet<Tuple<IMethodName, Double>> createSortedSetForMethodRecommendations() {
- final TreeSet<Tuple<IMethodName, Double>> res = Sets.newTreeSet(new Comparator<Tuple<IMethodName, Double>>() {
- @Override
- public int compare(final Tuple<IMethodName, Double> o1, final Tuple<IMethodName, Double> o2) {
- // the higher probability will be sorted above the lower values:
- final int probabilityCompare = Double.compare(o2.getSecond(), o1.getSecond());
- return probabilityCompare != 0 ? probabilityCompare : o1.getFirst().compareTo(o2.getFirst());
- }
- });
- return res;
- }
-
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.overrides;
+
+import static java.lang.String.format;
+import static org.eclipse.recommenders.utils.Checks.ensureEquals;
+
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.eclipse.recommenders.jayes.BayesNet;
+import org.eclipse.recommenders.jayes.BayesNode;
+import org.eclipse.recommenders.jayes.inference.junctionTree.JunctionTreeAlgorithm;
+import org.eclipse.recommenders.utils.Tuple;
+import org.eclipse.recommenders.utils.names.IMethodName;
+import org.eclipse.recommenders.utils.names.ITypeName;
+import org.eclipse.recommenders.utils.names.VmMethodName;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+public class ClassOverridesNetwork {
+
+ private final ITypeName typeName;
+
+ private final List<BayesNode> methodNodes;
+
+ private final JunctionTreeAlgorithm junctionTreeAlgorithm;
+
+ private HashMap<IMethodName, BayesNode> methodNameMapping;
+
+ protected ClassOverridesNetwork(final ITypeName typeName, final BayesNet network, final BayesNode patternNode,
+ final List<BayesNode> methodNodes) {
+ this.typeName = typeName;
+ this.methodNodes = methodNodes;
+ junctionTreeAlgorithm = new JunctionTreeAlgorithm();
+ junctionTreeAlgorithm.setNetwork(network);
+ createMethodNameMapping();
+ }
+
+ private void createMethodNameMapping() {
+ methodNameMapping = Maps.newHashMap();
+ for (final BayesNode methodNode : methodNodes) {
+ methodNameMapping.put(VmMethodName.get(methodNode.getName()), methodNode);
+ }
+ }
+
+ public void clearEvidence() {
+ junctionTreeAlgorithm.setEvidence(new HashMap<BayesNode, String>());
+ }
+
+ @Override
+ public String toString() {
+ return format("Model for '%s'", typeName);
+ }
+
+ public void observeMethodNode(final IMethodName methodName) {
+ final BayesNode methodNode = methodNameMapping.get(methodName);
+ if (methodNode != null) {
+ junctionTreeAlgorithm.addEvidence(methodNode, "true");
+ }
+ }
+
+ public SortedSet<Tuple<IMethodName, Double>> getRecommendedMethodOverrides(final double minProbability) {
+ final TreeSet<Tuple<IMethodName, Double>> recommendations = createSortedSetForMethodRecommendations();
+ for (final BayesNode node : methodNodes) {
+ if (junctionTreeAlgorithm.getEvidence().containsKey(node)) {
+ continue;
+ }
+ final double probability = junctionTreeAlgorithm.getBeliefs(node)[0];
+ if (probability < minProbability) {
+ continue;
+ }
+ final IMethodName method = VmMethodName.get(node.getName());
+ final Tuple<IMethodName, Double> item = Tuple.newTuple(method, probability);
+ recommendations.add(item);
+ }
+ return recommendations;
+ }
+
+ public SortedSet<Tuple<IMethodName, Double>> getRecommendedMethodOverrides(final double minProbabilityThreshold,
+ final int maxNumberOfRecommendations) {
+ final SortedSet<Tuple<IMethodName, Double>> recommendations = getRecommendedMethodOverrides(minProbabilityThreshold);
+ if (recommendations.size() <= maxNumberOfRecommendations) {
+ return recommendations;
+ }
+ // need to remove smaller items:
+ final Tuple<IMethodName, Double> firstExcludedRecommendation = Iterables.get(recommendations,
+ maxNumberOfRecommendations);
+ final SortedSet<Tuple<IMethodName, Double>> res = recommendations.headSet(firstExcludedRecommendation);
+ ensureEquals(res.size(), maxNumberOfRecommendations,
+ "filter op did not return expected number of compilationUnits2recommendationsIndex");
+ return res;
+ }
+
+ public static TreeSet<Tuple<IMethodName, Double>> createSortedSetForMethodRecommendations() {
+ final TreeSet<Tuple<IMethodName, Double>> res = Sets.newTreeSet(new Comparator<Tuple<IMethodName, Double>>() {
+ @Override
+ public int compare(final Tuple<IMethodName, Double> o1, final Tuple<IMethodName, Double> o2) {
+ // the higher probability will be sorted above the lower values:
+ final int probabilityCompare = Double.compare(o2.getSecond(), o1.getSecond());
+ return probabilityCompare != 0 ? probabilityCompare : o1.getFirst().compareTo(o2.getFirst());
+ }
+ });
+ return res;
+ }
+
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ClassOverridesNetworkBuilder.java b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ClassOverridesNetworkBuilder.java
index 2d3fb87..00aa441 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ClassOverridesNetworkBuilder.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ClassOverridesNetworkBuilder.java
@@ -1,146 +1,146 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.overrides;
-
-import static org.eclipse.recommenders.utils.Checks.ensureIsGreaterOrEqualTo;
-
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.apache.commons.collections.primitives.ArrayDoubleList;
-import org.apache.commons.lang3.ArrayUtils;
-import org.apache.commons.math.stat.StatUtils;
-import org.eclipse.recommenders.jayes.BayesNet;
-import org.eclipse.recommenders.jayes.BayesNode;
-import org.eclipse.recommenders.utils.names.IMethodName;
-import org.eclipse.recommenders.utils.names.ITypeName;
-
-import com.google.common.collect.Lists;
-
-public class ClassOverridesNetworkBuilder {
- private static final double MIN = 0.0001;
-
- private static final double MAX = 1.0 - MIN;
-
- private final ITypeName typeName;
-
- private final BayesNet network;
-
- private final Collection<ClassOverridesObservation> overriddenMethods;
-
- private int totalNumberOfSubtypesFound;
-
- private BayesNode patternNode;
-
- private LinkedList<BayesNode> methodNodes;
-
- public ClassOverridesNetworkBuilder(final ITypeName typeName,
- final Collection<ClassOverridesObservation> overriddenMethods) {
- this.typeName = typeName;
- this.overriddenMethods = overriddenMethods;
- // filterInfrequentOverridingPatterns();
- ensureIsGreaterOrEqualTo(overriddenMethods.size(), 1, "at least one observation is required");
- computeTotalNumberOfSubtypes();
- network = new BayesNet();
- }
-
- // private void filterInfrequentOverridingPatterns() {
- // for (final Iterator<ClassOverridesObservation> it = overriddenMethods.iterator(); it.hasNext();) {
- // final ClassOverridesObservation next = it.next();
- // if (next.frequency < 5) {
- // it.remove();
- // }
- // }
- // }
-
- private void computeTotalNumberOfSubtypes() {
- for (final ClassOverridesObservation usage : overriddenMethods) {
- totalNumberOfSubtypesFound += usage.frequency;
- }
- }
-
- public ClassOverridesNetwork build() {
- return new ClassOverridesNetwork(typeName, network, patternNode, methodNodes);
- }
-
- public void createPatternsNode() {
- createPatternNodeInNetwork();
- }
-
- private void createPatternNodeInNetwork() {
- patternNode = new BayesNode("patternNode");
- network.addNode(patternNode);
- patternNode.addOutcome("none");
- //
- final ArrayDoubleList def = new ArrayDoubleList();
- def.add(MIN);
- int i = 0;
- for (final ClassOverridesObservation obs : overriddenMethods) {
- i++;
- final String name = "observation_" + String.valueOf(i);
- patternNode.addOutcome(name);
- final double priorPatternProbability = obs.frequency / (double) totalNumberOfSubtypesFound;
- def.add(priorPatternProbability);
- }
- scaleMaximalValue(def);
- patternNode.setProbabilities(def.toArray());
- }
-
- private void scaleMaximalValue(final ArrayDoubleList subDefinition) {
- final double[] values = subDefinition.toArray();
- final double diff = StatUtils.sum(values) - 1.0;
- final double max = StatUtils.max(values);
- final int indexOf = ArrayUtils.indexOf(values, max);
- subDefinition.set(indexOf, values[indexOf] - diff);
- }
-
- public void createMethodNodes() {
- final Set<IMethodName> methods = collectInvokedMethodsFromPatterns();
- methodNodes = Lists.newLinkedList();
- for (final IMethodName ref : methods) {
- final BayesNode methodNode = new BayesNode(ref.getIdentifier());
- network.addNode(methodNode);
- methodNode.setParents(Lists.newArrayList(patternNode));
- methodNode.addOutcome("true");
- methodNode.addOutcome("false");
- methodNode.setProbabilities(createMethodNodeDefinition(ref));
- methodNodes.add(methodNode);
- }
- }
-
- private double[] createMethodNodeDefinition(final IMethodName ref) {
- final ArrayDoubleList definition = new ArrayDoubleList();
- definition.add(0.0);
- definition.add(1.0);
- for (final ClassOverridesObservation pattern : overriddenMethods) {
- final boolean overridesMethod = pattern.overriddenMethods.contains(ref);
- if (overridesMethod) {
- definition.add(MAX);
- definition.add(MIN);
- } else {
- // just flip
- definition.add(MIN);
- definition.add(MAX);
- }
- }
- return definition.toArray();
- }
-
- private TreeSet<IMethodName> collectInvokedMethodsFromPatterns() {
- final TreeSet<IMethodName> methods = new TreeSet<IMethodName>();
- for (final ClassOverridesObservation observation : overriddenMethods) {
- methods.addAll(observation.overriddenMethods);
- }
- return methods;
- }
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.overrides;
+
+import static org.eclipse.recommenders.utils.Checks.ensureIsGreaterOrEqualTo;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.commons.collections.primitives.ArrayDoubleList;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.math.stat.StatUtils;
+import org.eclipse.recommenders.jayes.BayesNet;
+import org.eclipse.recommenders.jayes.BayesNode;
+import org.eclipse.recommenders.utils.names.IMethodName;
+import org.eclipse.recommenders.utils.names.ITypeName;
+
+import com.google.common.collect.Lists;
+
+public class ClassOverridesNetworkBuilder {
+ private static final double MIN = 0.0001;
+
+ private static final double MAX = 1.0 - MIN;
+
+ private final ITypeName typeName;
+
+ private final BayesNet network;
+
+ private final Collection<ClassOverridesObservation> overriddenMethods;
+
+ private int totalNumberOfSubtypesFound;
+
+ private BayesNode patternNode;
+
+ private LinkedList<BayesNode> methodNodes;
+
+ public ClassOverridesNetworkBuilder(final ITypeName typeName,
+ final Collection<ClassOverridesObservation> overriddenMethods) {
+ this.typeName = typeName;
+ this.overriddenMethods = overriddenMethods;
+ // filterInfrequentOverridingPatterns();
+ ensureIsGreaterOrEqualTo(overriddenMethods.size(), 1, "at least one observation is required");
+ computeTotalNumberOfSubtypes();
+ network = new BayesNet();
+ }
+
+ // private void filterInfrequentOverridingPatterns() {
+ // for (final Iterator<ClassOverridesObservation> it = overriddenMethods.iterator(); it.hasNext();) {
+ // final ClassOverridesObservation next = it.next();
+ // if (next.frequency < 5) {
+ // it.remove();
+ // }
+ // }
+ // }
+
+ private void computeTotalNumberOfSubtypes() {
+ for (final ClassOverridesObservation usage : overriddenMethods) {
+ totalNumberOfSubtypesFound += usage.frequency;
+ }
+ }
+
+ public ClassOverridesNetwork build() {
+ return new ClassOverridesNetwork(typeName, network, patternNode, methodNodes);
+ }
+
+ public void createPatternsNode() {
+ createPatternNodeInNetwork();
+ }
+
+ private void createPatternNodeInNetwork() {
+ patternNode = new BayesNode("patternNode");
+ network.addNode(patternNode);
+ patternNode.addOutcome("none");
+ //
+ final ArrayDoubleList def = new ArrayDoubleList();
+ def.add(MIN);
+ int i = 0;
+ for (final ClassOverridesObservation obs : overriddenMethods) {
+ i++;
+ final String name = "observation_" + String.valueOf(i);
+ patternNode.addOutcome(name);
+ final double priorPatternProbability = obs.frequency / (double) totalNumberOfSubtypesFound;
+ def.add(priorPatternProbability);
+ }
+ scaleMaximalValue(def);
+ patternNode.setProbabilities(def.toArray());
+ }
+
+ private void scaleMaximalValue(final ArrayDoubleList subDefinition) {
+ final double[] values = subDefinition.toArray();
+ final double diff = StatUtils.sum(values) - 1.0;
+ final double max = StatUtils.max(values);
+ final int indexOf = ArrayUtils.indexOf(values, max);
+ subDefinition.set(indexOf, values[indexOf] - diff);
+ }
+
+ public void createMethodNodes() {
+ final Set<IMethodName> methods = collectInvokedMethodsFromPatterns();
+ methodNodes = Lists.newLinkedList();
+ for (final IMethodName ref : methods) {
+ final BayesNode methodNode = new BayesNode(ref.getIdentifier());
+ network.addNode(methodNode);
+ methodNode.setParents(Lists.newArrayList(patternNode));
+ methodNode.addOutcome("true");
+ methodNode.addOutcome("false");
+ methodNode.setProbabilities(createMethodNodeDefinition(ref));
+ methodNodes.add(methodNode);
+ }
+ }
+
+ private double[] createMethodNodeDefinition(final IMethodName ref) {
+ final ArrayDoubleList definition = new ArrayDoubleList();
+ definition.add(0.0);
+ definition.add(1.0);
+ for (final ClassOverridesObservation pattern : overriddenMethods) {
+ final boolean overridesMethod = pattern.overriddenMethods.contains(ref);
+ if (overridesMethod) {
+ definition.add(MAX);
+ definition.add(MIN);
+ } else {
+ // just flip
+ definition.add(MIN);
+ definition.add(MAX);
+ }
+ }
+ return definition.toArray();
+ }
+
+ private TreeSet<IMethodName> collectInvokedMethodsFromPatterns() {
+ final TreeSet<IMethodName> methods = new TreeSet<IMethodName>();
+ for (final ClassOverridesObservation observation : overriddenMethods) {
+ methods.addAll(observation.overriddenMethods);
+ }
+ return methods;
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ManualModelStoreWiring.java b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ManualModelStoreWiring.java
index 9d24055..d1c2cb3 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ManualModelStoreWiring.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/ManualModelStoreWiring.java
@@ -58,4 +58,4 @@ public class ManualModelStoreWiring {
});
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesCompletionProposalComputer.java b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesCompletionProposalComputer.java
index 7343b97..40912ec 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesCompletionProposalComputer.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesCompletionProposalComputer.java
@@ -1,118 +1,118 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.overrides;
-
-import static java.lang.Math.rint;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map.Entry;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.CompletionProposal;
-import org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal;
-import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
-import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
-import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer;
-import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
-import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContext;
-import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContextFactory;
-import org.eclipse.recommenders.rcp.RecommendersPlugin;
-import org.eclipse.recommenders.utils.rcp.CompletionProposalDecorator;
-
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-
-@SuppressWarnings({ "unchecked", "rawtypes" })
-public class OverridesCompletionProposalComputer implements IJavaCompletionProposalComputer {
-
- private IRecommendersCompletionContext ctx;
- private List<OverridesRecommendation> recommendations=Collections.emptyList();
- private List<IJavaCompletionProposal> proposals;
-
- private OverridesRecommender recommender;
- private IRecommendersCompletionContextFactory contextFactory;
-
- @Inject
- public OverridesCompletionProposalComputer(OverridesRecommender recommender,
- IRecommendersCompletionContextFactory contextFactory) {
- this.recommender = recommender;
- this.contextFactory = contextFactory;
- };
-
- @Override
- public List computeCompletionProposals(final ContentAssistInvocationContext context, final IProgressMonitor monitor) {
- proposals = Lists.newLinkedList();
- if (context instanceof JavaContentAssistInvocationContext) {
- try {
- JavaContentAssistInvocationContext jdtContext = (JavaContentAssistInvocationContext) context;
- ctx = contextFactory.create(jdtContext);
- recommender.startSession(ctx);
- recommendations = recommender.getRecommendations();
- computeProposals();
- } catch (CoreException e) {
- RecommendersPlugin.log(e);
- }
- }
- return proposals;
- }
-
- private void computeProposals() {
- final String prefix = ctx.getPrefix();
- for (Entry<IJavaCompletionProposal, CompletionProposal> pair : ctx.getProposals().entrySet()) {
- IJavaCompletionProposal uiProposal = pair.getKey();
- CompletionProposal cProposal = pair.getValue();
- switch (cProposal.getKind()) {
- case CompletionProposal.METHOD_DECLARATION:
- final String signature = String.valueOf(cProposal.getSignature()).replace('.', '/');
- final String name = String.valueOf(cProposal.getName());
- final String propSignature = (name + signature).replaceAll("<\\.>", "");
- for (final OverridesRecommendation r : recommendations) {
- if (!r.method.getName().startsWith(prefix)) {
- continue;
- }
-
- final String recSignature = r.method.getSignature();
- if (recSignature.equals(propSignature)) {
- if (uiProposal instanceof AbstractJavaCompletionProposal) {
- int baseRelevance = uiProposal.getRelevance();
- baseRelevance += (int) rint(r.probability * 100);
- ((AbstractJavaCompletionProposal) uiProposal).setRelevance(baseRelevance);
- }
- final CompletionProposalDecorator decoratedProposal =
- new CompletionProposalDecorator(uiProposal, r.probability);
- proposals.add(decoratedProposal);
- }
- }
- }
- }
- }
-
- @Override
- public void sessionStarted() {
- }
-
- @Override
- public List computeContextInformation(final ContentAssistInvocationContext context, final IProgressMonitor monitor) {
- return Collections.emptyList();
- }
-
- @Override
- public String getErrorMessage() {
- return null;
- }
-
- @Override
- public void sessionEnded() {
- }
-
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.overrides;
+
+import static java.lang.Math.rint;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.CompletionProposal;
+import org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal;
+import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer;
+import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
+import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContext;
+import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContextFactory;
+import org.eclipse.recommenders.rcp.RecommendersPlugin;
+import org.eclipse.recommenders.utils.rcp.CompletionProposalDecorator;
+
+import com.google.common.collect.Lists;
+import com.google.inject.Inject;
+
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class OverridesCompletionProposalComputer implements IJavaCompletionProposalComputer {
+
+ private IRecommendersCompletionContext ctx;
+ private List<OverridesRecommendation> recommendations=Collections.emptyList();
+ private List<IJavaCompletionProposal> proposals;
+
+ private OverridesRecommender recommender;
+ private IRecommendersCompletionContextFactory contextFactory;
+
+ @Inject
+ public OverridesCompletionProposalComputer(OverridesRecommender recommender,
+ IRecommendersCompletionContextFactory contextFactory) {
+ this.recommender = recommender;
+ this.contextFactory = contextFactory;
+ };
+
+ @Override
+ public List computeCompletionProposals(final ContentAssistInvocationContext context, final IProgressMonitor monitor) {
+ proposals = Lists.newLinkedList();
+ if (context instanceof JavaContentAssistInvocationContext) {
+ try {
+ JavaContentAssistInvocationContext jdtContext = (JavaContentAssistInvocationContext) context;
+ ctx = contextFactory.create(jdtContext);
+ recommender.startSession(ctx);
+ recommendations = recommender.getRecommendations();
+ computeProposals();
+ } catch (CoreException e) {
+ RecommendersPlugin.log(e);
+ }
+ }
+ return proposals;
+ }
+
+ private void computeProposals() {
+ final String prefix = ctx.getPrefix();
+ for (Entry<IJavaCompletionProposal, CompletionProposal> pair : ctx.getProposals().entrySet()) {
+ IJavaCompletionProposal uiProposal = pair.getKey();
+ CompletionProposal cProposal = pair.getValue();
+ switch (cProposal.getKind()) {
+ case CompletionProposal.METHOD_DECLARATION:
+ final String signature = String.valueOf(cProposal.getSignature()).replace('.', '/');
+ final String name = String.valueOf(cProposal.getName());
+ final String propSignature = (name + signature).replaceAll("<\\.>", "");
+ for (final OverridesRecommendation r : recommendations) {
+ if (!r.method.getName().startsWith(prefix)) {
+ continue;
+ }
+
+ final String recSignature = r.method.getSignature();
+ if (recSignature.equals(propSignature)) {
+ if (uiProposal instanceof AbstractJavaCompletionProposal) {
+ int baseRelevance = uiProposal.getRelevance();
+ baseRelevance += (int) rint(r.probability * 100);
+ ((AbstractJavaCompletionProposal) uiProposal).setRelevance(baseRelevance);
+ }
+ final CompletionProposalDecorator decoratedProposal =
+ new CompletionProposalDecorator(uiProposal, r.probability);
+ proposals.add(decoratedProposal);
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void sessionStarted() {
+ }
+
+ @Override
+ public List computeContextInformation(final ContentAssistInvocationContext context, final IProgressMonitor monitor) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public String getErrorMessage() {
+ return null;
+ }
+
+ @Override
+ public void sessionEnded() {
+ }
+
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesModule.java b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesModule.java
index 6cc7a1d..749988c 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesModule.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesModule.java
@@ -1,59 +1,59 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.overrides;
-
-import static java.lang.String.format;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.io.File;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.recommenders.internal.completion.rcp.overrides.ManualModelStoreWiring.OverridesModelArchiveStore;
-import org.eclipse.recommenders.internal.rcp.models.IModelArchiveStore;
-import org.osgi.framework.FrameworkUtil;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.BindingAnnotation;
-import com.google.inject.Scopes;
-import com.google.inject.TypeLiteral;
-
-public class OverridesModule extends AbstractModule {
-
- public static final String MODEL_VERSION = "0.1";
-
- public static TypeLiteral<IModelArchiveStore<IType, ClassOverridesNetwork>> STORE = new TypeLiteral<IModelArchiveStore<IType, ClassOverridesNetwork>>() {
- };
-
- @Override
- protected void configure() {
- bindCompletionEngine();
- }
-
- private void bindCompletionEngine() {
- bind(OverridesCompletionProposalComputer.class).in(Scopes.SINGLETON);
- final IPath stateLocation = Platform.getStateLocation(FrameworkUtil.getBundle(getClass()));
- final File index = new File(stateLocation.toFile(), format("ovrm-models-%s.json", MODEL_VERSION));
- bind(File.class).annotatedWith(OverridesModelStore.class).toInstance(index);
- bind(STORE).to(OverridesModelArchiveStore.class).in(Scopes.SINGLETON);
- }
-
- @BindingAnnotation
- @Target({ PARAMETER, METHOD })
- @Retention(RUNTIME)
- static @interface OverridesModelStore {
- }
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.overrides;
+
+import static java.lang.String.format;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.io.File;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.recommenders.internal.completion.rcp.overrides.ManualModelStoreWiring.OverridesModelArchiveStore;
+import org.eclipse.recommenders.internal.rcp.models.IModelArchiveStore;
+import org.osgi.framework.FrameworkUtil;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.BindingAnnotation;
+import com.google.inject.Scopes;
+import com.google.inject.TypeLiteral;
+
+public class OverridesModule extends AbstractModule {
+
+ public static final String MODEL_VERSION = "0.1";
+
+ public static TypeLiteral<IModelArchiveStore<IType, ClassOverridesNetwork>> STORE = new TypeLiteral<IModelArchiveStore<IType, ClassOverridesNetwork>>() {
+ };
+
+ @Override
+ protected void configure() {
+ bindCompletionEngine();
+ }
+
+ private void bindCompletionEngine() {
+ bind(OverridesCompletionProposalComputer.class).in(Scopes.SINGLETON);
+ final IPath stateLocation = Platform.getStateLocation(FrameworkUtil.getBundle(getClass()));
+ final File index = new File(stateLocation.toFile(), format("ovrm-models-%s.json", MODEL_VERSION));
+ bind(File.class).annotatedWith(OverridesModelStore.class).toInstance(index);
+ bind(STORE).to(OverridesModelArchiveStore.class).in(Scopes.SINGLETON);
+ }
+
+ @BindingAnnotation
+ @Target({ PARAMETER, METHOD })
+ @Retention(RUNTIME)
+ static @interface OverridesModelStore {
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesRecommendation.java b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesRecommendation.java
index 6d2fad8..0ea017b 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesRecommendation.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesRecommendation.java
@@ -1,37 +1,37 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.overrides;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import org.eclipse.recommenders.rcp.IRecommendation;
-import org.eclipse.recommenders.utils.names.IMethodName;
-
-public class OverridesRecommendation implements IRecommendation {
- public final IMethodName method;
-
- public final double probability;
-
- public OverridesRecommendation(final IMethodName method, final double probability) {
- this.method = method;
- this.probability = probability;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE);
- }
-
- @Override
- public double getProbability() {
- return probability;
- }
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.overrides;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import org.eclipse.recommenders.rcp.IRecommendation;
+import org.eclipse.recommenders.utils.names.IMethodName;
+
+public class OverridesRecommendation implements IRecommendation {
+ public final IMethodName method;
+
+ public final double probability;
+
+ public OverridesRecommendation(final IMethodName method, final double probability) {
+ this.method = method;
+ this.probability = probability;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE);
+ }
+
+ @Override
+ public double getProbability() {
+ return probability;
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesRecommender.java b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesRecommender.java
index 520d018..535c763 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesRecommender.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesRecommender.java
@@ -1,122 +1,122 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.overrides;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContext;
-import org.eclipse.recommenders.internal.rcp.models.IModelArchiveStore;
-import org.eclipse.recommenders.internal.utils.codestructs.MethodDeclaration;
-import org.eclipse.recommenders.internal.utils.codestructs.TypeDeclaration;
-import org.eclipse.recommenders.utils.Tuple;
-import org.eclipse.recommenders.utils.names.IMethodName;
-import org.eclipse.recommenders.utils.names.VmMethodName;
-import org.eclipse.recommenders.utils.rcp.JavaElementResolver;
-import org.eclipse.recommenders.utils.rcp.JdtUtils;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
-import com.google.inject.Inject;
-
-public class OverridesRecommender {
-
- private final double MIN_PROBABILITY_THRESHOLD = 0.1d;
-
- private IModelArchiveStore<IType, ClassOverridesNetwork> modelStore;
- private final JavaElementResolver jdtCache;
-
- private IType enclosingType;
- private IType supertype;
- private List<OverridesRecommendation> recommendations= Collections.emptyList();
- private ClassOverridesNetwork model;
-
- private IRecommendersCompletionContext ctx;
-
- @Inject
- public OverridesRecommender(IModelArchiveStore<IType, ClassOverridesNetwork> modelStore,
- final JavaElementResolver jdtCache) {
- this.modelStore = modelStore;
- this.jdtCache = jdtCache;
- };
-
- public void startSession(IRecommendersCompletionContext context) throws JavaModelException {
- this.ctx = context;
- if (findEnclosingType() && findSuperclass() && hasModel()) {
- try {
- computeRecommendations();
- } finally {
- releaseModel();
- }
- }
- }
-
- private boolean findEnclosingType() {
- enclosingType = ctx.getEnclosingType().orNull();
- return enclosingType != null;
- }
-
- private boolean findSuperclass() {
- supertype = JdtUtils.findSuperclass(enclosingType).orNull();
- return supertype != null;
- }
-
- private boolean hasModel() {
- model = modelStore.aquireModel(supertype).orNull();
- return model != null;
- }
-
- private void computeRecommendations() throws JavaModelException {
- final TypeDeclaration query = computeQuery();
- for (final MethodDeclaration method : query.methods) {
- model.observeMethodNode(method.superDeclaration);
- }
- recommendations = readRecommendations();
- }
-
- private TypeDeclaration computeQuery() throws JavaModelException {
- final TypeDeclaration query = TypeDeclaration.create(null, jdtCache.toRecType(supertype));
- for (final IMethod m : enclosingType.getMethods()) {
- final Optional<IMethod> superMethod = JdtUtils.findOverriddenMethod(m);
- if (superMethod.isPresent()) {
- final IMethodName recMethod = jdtCache.toRecMethod(m).or(VmMethodName.NULL);
- final IMethodName recSuperMethod = jdtCache.toRecMethod(superMethod.get()).or(VmMethodName.NULL);
- final MethodDeclaration create = MethodDeclaration.create(recMethod);
- create.superDeclaration = recSuperMethod;
- query.methods.add(create);
- }
- }
- return query;
- }
-
- private List<OverridesRecommendation> readRecommendations() {
- final List<OverridesRecommendation> res = Lists.newLinkedList();
- for (final Tuple<IMethodName, Double> item : model.getRecommendedMethodOverrides(MIN_PROBABILITY_THRESHOLD, 5)) {
- final IMethodName method = item.getFirst();
- final Double probability = item.getSecond();
- final OverridesRecommendation recommendation = new OverridesRecommendation(method, probability);
- res.add(recommendation);
- }
- return res;
- }
-
- public List<OverridesRecommendation> getRecommendations() {
- return recommendations;
- }
-
- private void releaseModel() {
- if (model != null) modelStore.releaseModel(model);
- }
-
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.overrides;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContext;
+import org.eclipse.recommenders.internal.rcp.models.IModelArchiveStore;
+import org.eclipse.recommenders.internal.utils.codestructs.MethodDeclaration;
+import org.eclipse.recommenders.internal.utils.codestructs.TypeDeclaration;
+import org.eclipse.recommenders.utils.Tuple;
+import org.eclipse.recommenders.utils.names.IMethodName;
+import org.eclipse.recommenders.utils.names.VmMethodName;
+import org.eclipse.recommenders.utils.rcp.JavaElementResolver;
+import org.eclipse.recommenders.utils.rcp.JdtUtils;
+
+import com.google.common.base.Optional;
+import com.google.common.collect.Lists;
+import com.google.inject.Inject;
+
+public class OverridesRecommender {
+
+ private final double MIN_PROBABILITY_THRESHOLD = 0.1d;
+
+ private IModelArchiveStore<IType, ClassOverridesNetwork> modelStore;
+ private final JavaElementResolver jdtCache;
+
+ private IType enclosingType;
+ private IType supertype;
+ private List<OverridesRecommendation> recommendations= Collections.emptyList();
+ private ClassOverridesNetwork model;
+
+ private IRecommendersCompletionContext ctx;
+
+ @Inject
+ public OverridesRecommender(IModelArchiveStore<IType, ClassOverridesNetwork> modelStore,
+ final JavaElementResolver jdtCache) {
+ this.modelStore = modelStore;
+ this.jdtCache = jdtCache;
+ };
+
+ public void startSession(IRecommendersCompletionContext context) throws JavaModelException {
+ this.ctx = context;
+ if (findEnclosingType() && findSuperclass() && hasModel()) {
+ try {
+ computeRecommendations();
+ } finally {
+ releaseModel();
+ }
+ }
+ }
+
+ private boolean findEnclosingType() {
+ enclosingType = ctx.getEnclosingType().orNull();
+ return enclosingType != null;
+ }
+
+ private boolean findSuperclass() {
+ supertype = JdtUtils.findSuperclass(enclosingType).orNull();
+ return supertype != null;
+ }
+
+ private boolean hasModel() {
+ model = modelStore.aquireModel(supertype).orNull();
+ return model != null;
+ }
+
+ private void computeRecommendations() throws JavaModelException {
+ final TypeDeclaration query = computeQuery();
+ for (final MethodDeclaration method : query.methods) {
+ model.observeMethodNode(method.superDeclaration);
+ }
+ recommendations = readRecommendations();
+ }
+
+ private TypeDeclaration computeQuery() throws JavaModelException {
+ final TypeDeclaration query = TypeDeclaration.create(null, jdtCache.toRecType(supertype));
+ for (final IMethod m : enclosingType.getMethods()) {
+ final Optional<IMethod> superMethod = JdtUtils.findOverriddenMethod(m);
+ if (superMethod.isPresent()) {
+ final IMethodName recMethod = jdtCache.toRecMethod(m).or(VmMethodName.NULL);
+ final IMethodName recSuperMethod = jdtCache.toRecMethod(superMethod.get()).or(VmMethodName.NULL);
+ final MethodDeclaration create = MethodDeclaration.create(recMethod);
+ create.superDeclaration = recSuperMethod;
+ query.methods.add(create);
+ }
+ }
+ return query;
+ }
+
+ private List<OverridesRecommendation> readRecommendations() {
+ final List<OverridesRecommendation> res = Lists.newLinkedList();
+ for (final Tuple<IMethodName, Double> item : model.getRecommendedMethodOverrides(MIN_PROBABILITY_THRESHOLD, 5)) {
+ final IMethodName method = item.getFirst();
+ final Double probability = item.getSecond();
+ final OverridesRecommendation recommendation = new OverridesRecommendation(method, probability);
+ res.add(recommendation);
+ }
+ return res;
+ }
+
+ public List<OverridesRecommendation> getRecommendations() {
+ return recommendations;
+ }
+
+ private void releaseModel() {
+ if (model != null) modelStore.releaseModel(model);
+ }
+
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesSessionProcessor.java b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesSessionProcessor.java
index 5ec4f84..e824f28 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesSessionProcessor.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesSessionProcessor.java
@@ -1,70 +1,70 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.overrides;
-
-import static java.lang.Math.rint;
-import static org.eclipse.recommenders.internal.completion.rcp.ProcessableCompletionProposalComputer.NULL_PROPOSAL;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.CompletionProposal;
-import org.eclipse.recommenders.completion.rcp.IProcessableProposal;
-import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContext;
-import org.eclipse.recommenders.completion.rcp.ProposalProcessorManager;
-import org.eclipse.recommenders.completion.rcp.SessionProcessor;
-import org.eclipse.recommenders.internal.completion.rcp.SimpleProposalProcessor;
-import org.eclipse.recommenders.rcp.RecommendersPlugin;
-
-import com.google.inject.Inject;
-
-public class OverridesSessionProcessor extends SessionProcessor {
-
- private List<OverridesRecommendation> recommendations;
-
- private OverridesRecommender recommender;
-
- @Inject
- public OverridesSessionProcessor(OverridesRecommender recommender) {
- this.recommender = recommender;
- }
-
- @Override
- public void startSession(IRecommendersCompletionContext context) {
- try {
- recommender.startSession(context);
- recommendations = recommender.getRecommendations();
- } catch (CoreException e) {
- RecommendersPlugin.log(e);
- }
- }
-
- @Override
- public void process(IProcessableProposal proposal) {
- CompletionProposal cProposal = proposal.getCoreProposal().or(NULL_PROPOSAL);
- switch (cProposal.getKind()) {
- case CompletionProposal.METHOD_DECLARATION:
- final String signature = String.valueOf(cProposal.getSignature()).replace('.', '/');
- final String name = String.valueOf(cProposal.getName());
- final String propSignature = (name + signature).replaceAll("<\\.>", "");
- for (final OverridesRecommendation r : recommendations) {
- final String recSignature = r.method.getSignature();
- if (recSignature.equals(propSignature)) {
- final int percentage = (int) rint(r.probability * 100);
- int increment = 100 + percentage << 3;
- String label = percentage + "%";
- ProposalProcessorManager mgr = proposal.getProposalProcessorManager();
- mgr.addProcessor(new SimpleProposalProcessor(increment, label));
- }
- }
- }
- }
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.overrides;
+
+import static java.lang.Math.rint;
+import static org.eclipse.recommenders.internal.completion.rcp.ProcessableCompletionProposalComputer.NULL_PROPOSAL;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.CompletionProposal;
+import org.eclipse.recommenders.completion.rcp.IProcessableProposal;
+import org.eclipse.recommenders.completion.rcp.IRecommendersCompletionContext;
+import org.eclipse.recommenders.completion.rcp.ProposalProcessorManager;
+import org.eclipse.recommenders.completion.rcp.SessionProcessor;
+import org.eclipse.recommenders.internal.completion.rcp.SimpleProposalProcessor;
+import org.eclipse.recommenders.rcp.RecommendersPlugin;
+
+import com.google.inject.Inject;
+
+public class OverridesSessionProcessor extends SessionProcessor {
+
+ private List<OverridesRecommendation> recommendations;
+
+ private OverridesRecommender recommender;
+
+ @Inject
+ public OverridesSessionProcessor(OverridesRecommender recommender) {
+ this.recommender = recommender;
+ }
+
+ @Override
+ public void startSession(IRecommendersCompletionContext context) {
+ try {
+ recommender.startSession(context);
+ recommendations = recommender.getRecommendations();
+ } catch (CoreException e) {
+ RecommendersPlugin.log(e);
+ }
+ }
+
+ @Override
+ public void process(IProcessableProposal proposal) {
+ CompletionProposal cProposal = proposal.getCoreProposal().or(NULL_PROPOSAL);
+ switch (cProposal.getKind()) {
+ case CompletionProposal.METHOD_DECLARATION:
+ final String signature = String.valueOf(cProposal.getSignature()).replace('.', '/');
+ final String name = String.valueOf(cProposal.getName());
+ final String propSignature = (name + signature).replaceAll("<\\.>", "");
+ for (final OverridesRecommendation r : recommendations) {
+ final String recSignature = r.method.getSignature();
+ if (recSignature.equals(propSignature)) {
+ final int percentage = (int) rint(r.probability * 100);
+ int increment = 100 + percentage << 3;
+ String label = percentage + "%";
+ ProposalProcessorManager mgr = proposal.getProposalProcessorManager();
+ mgr.addProcessor(new SimpleProposalProcessor(increment, label));
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesZipModelFactory.java b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesZipModelFactory.java
index e9db816..5acaa38 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesZipModelFactory.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.overrides/src/org/eclipse/recommenders/internal/completion/rcp/overrides/OverridesZipModelFactory.java
@@ -79,4 +79,4 @@ public final class OverridesZipModelFactory extends ZipPoolableModelFactory<ITyp
public void activateModel(IType key, ClassOverridesNetwork model) {
model.clearEvidence();
};
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.sandbox/plugin.xml b/plugins/org.eclipse.recommenders.completion.rcp.sandbox/plugin.xml
index 07b97be..e41cbee 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.sandbox/plugin.xml
+++ b/plugins/org.eclipse.recommenders.completion.rcp.sandbox/plugin.xml
@@ -1,32 +1,32 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.recommenders.completion.rcp.sessionprocessors">
- <processor
- class="org.eclipse.recommenders.internal.completion.rcp.sandbox.Subwords2SessionProcessor"
- icon="icons/elcl16/category.gif"
- id="org.eclipse.recommenders.completion.rcp.subwords2.processor"
- name="Assigment Name Processor">
- </processor>
- <processor
- class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.sandbox.TypeProposalsProcessor"
- icon="icons/elcl16/category.gif"
- id="org.eclipse.recommenders.completion.rcp.types.processor"
- name="Types">
- </processor>
- <processor
- class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.sandbox.HippieCompletionSessionProcessor"
- icon="icons/elcl16/category.gif"
- id="org.eclipse.recommenders.completion.rcp.hippie.processor"
- name="Hippie">
- </processor>
- <processor
- class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.sandbox.TypoSessionProcessor"
- icon="icons/elcl16/category.gif"
- id="org.eclipse.recommenders.completion.rcp.typo.processor"
- name="Typo">
- </processor>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.recommenders.completion.rcp.sessionprocessors">
+ <processor
+ class="org.eclipse.recommenders.internal.completion.rcp.sandbox.Subwords2SessionProcessor"
+ icon="icons/elcl16/category.gif"
+ id="org.eclipse.recommenders.completion.rcp.subwords2.processor"
+ name="Assigment Name Processor">
+ </processor>
+ <processor
+ class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.sandbox.TypeProposalsProcessor"
+ icon="icons/elcl16/category.gif"
+ id="org.eclipse.recommenders.completion.rcp.types.processor"
+ name="Types">
+ </processor>
+ <processor
+ class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.sandbox.HippieCompletionSessionProcessor"
+ icon="icons/elcl16/category.gif"
+ id="org.eclipse.recommenders.completion.rcp.hippie.processor"
+ name="Hippie">
+ </processor>
+ <processor
+ class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.sandbox.TypoSessionProcessor"
+ icon="icons/elcl16/category.gif"
+ id="org.eclipse.recommenders.completion.rcp.typo.processor"
+ name="Typo">
+ </processor>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.sandbox/pom.xml b/plugins/org.eclipse.recommenders.completion.rcp.sandbox/pom.xml
index 8d8b0d1..297d8bc 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.sandbox/pom.xml
+++ b/plugins/org.eclipse.recommenders.completion.rcp.sandbox/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.plugin</groupId>
- <artifactId>org.eclipse.recommenders.plugin.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.plugin</groupId>
+ <artifactId>org.eclipse.recommenders.plugin.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.completion.rcp.sandbox</artifactId>
- <packaging>eclipse-plugin</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.completion.rcp.sandbox</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.sandbox/src/org/eclipse/recommenders/internal/completion/rcp/sandbox/TypeProposalsProcessor.java b/plugins/org.eclipse.recommenders.completion.rcp.sandbox/src/org/eclipse/recommenders/internal/completion/rcp/sandbox/TypeProposalsProcessor.java
index 1388b4a..395ed9e 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.sandbox/src/org/eclipse/recommenders/internal/completion/rcp/sandbox/TypeProposalsProcessor.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.sandbox/src/org/eclipse/recommenders/internal/completion/rcp/sandbox/TypeProposalsProcessor.java
@@ -225,4 +225,4 @@ public final class TypeProposalsProcessor extends SessionProcessor {
}
}
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.sandbox/src/org/eclipse/recommenders/internal/completion/rcp/sandbox/TypoSessionProcessor.java b/plugins/org.eclipse.recommenders.completion.rcp.sandbox/src/org/eclipse/recommenders/internal/completion/rcp/sandbox/TypoSessionProcessor.java
index 5d700ab..162b469 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.sandbox/src/org/eclipse/recommenders/internal/completion/rcp/sandbox/TypoSessionProcessor.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.sandbox/src/org/eclipse/recommenders/internal/completion/rcp/sandbox/TypoSessionProcessor.java
@@ -190,4 +190,4 @@ public final class TypoSessionProcessor extends SessionProcessor {
}
return completion;
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.subwords/plugin.xml b/plugins/org.eclipse.recommenders.completion.rcp.subwords/plugin.xml
index 06e76c3..38dc65e 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.subwords/plugin.xml
+++ b/plugins/org.eclipse.recommenders.completion.rcp.subwords/plugin.xml
@@ -1,38 +1,38 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- id="org.eclipse.recommenders.subwords.rcp.category"
- point="org.eclipse.jdt.ui.javaCompletionProposalComputer">
- <javaCompletionProposalComputer
- activate="true"
- categoryId="org.eclipse.recommenders.subwords.rcp.category"
- class="org.eclipse.recommenders.internal.completion.rcp.subwords.SubwordsCompletionProposalComputer"
- needsSortingAfterFiltering="true"/>
- </extension>
- <extension
- id="org.eclipse.recommenders.subwords.rcp.category"
- name="Java Subwords Proposals (Recommenders)"
- point="org.eclipse.jdt.ui.javaCompletionProposalComputer">
- <proposalCategory
- icon="icons/elcl16/category.gif"></proposalCategory>
- </extension>
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- category="org.eclipse.recommenders.rcp.category.preferences"
- class="org.eclipse.recommenders.internal.completion.rcp.subwords.PreferencePage"
- id="org.eclipse.recommenders.internal.completion.rcp.subwords.PreferencePage"
- name="Subwords">
- </page>
- </extension>
- <extension
- point="org.eclipse.recommenders.completion.rcp.sessionprocessors">
- <processor
- class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.subwords.SubwordsSessionProcessor"
- icon="icons/elcl16/category.gif"
- id="org.eclipse.recommenders.completion.rcp.subwords.processor"
- name="Subwords Completion Processor">
- </processor>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ id="org.eclipse.recommenders.subwords.rcp.category"
+ point="org.eclipse.jdt.ui.javaCompletionProposalComputer">
+ <javaCompletionProposalComputer
+ activate="true"
+ categoryId="org.eclipse.recommenders.subwords.rcp.category"
+ class="org.eclipse.recommenders.internal.completion.rcp.subwords.SubwordsCompletionProposalComputer"
+ needsSortingAfterFiltering="true"/>
+ </extension>
+ <extension
+ id="org.eclipse.recommenders.subwords.rcp.category"
+ name="Java Subwords Proposals (Recommenders)"
+ point="org.eclipse.jdt.ui.javaCompletionProposalComputer">
+ <proposalCategory
+ icon="icons/elcl16/category.gif"></proposalCategory>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.recommenders.rcp.category.preferences"
+ class="org.eclipse.recommenders.internal.completion.rcp.subwords.PreferencePage"
+ id="org.eclipse.recommenders.internal.completion.rcp.subwords.PreferencePage"
+ name="Subwords">
+ </page>
</extension>
-</plugin>
+ <extension
+ point="org.eclipse.recommenders.completion.rcp.sessionprocessors">
+ <processor
+ class="org.eclipse.recommenders.injection.ExtensionFactory:org.eclipse.recommenders.internal.completion.rcp.subwords.SubwordsSessionProcessor"
+ icon="icons/elcl16/category.gif"
+ id="org.eclipse.recommenders.completion.rcp.subwords.processor"
+ name="Subwords Completion Processor">
+ </processor>
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.subwords/pom.xml b/plugins/org.eclipse.recommenders.completion.rcp.subwords/pom.xml
index d464c23..3dd04ee 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.subwords/pom.xml
+++ b/plugins/org.eclipse.recommenders.completion.rcp.subwords/pom.xml
@@ -1,20 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <parent>
- <groupId>org.eclipse.recommenders.plugin</groupId>
- <artifactId>org.eclipse.recommenders.plugin.parent</artifactId>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <parent>
+ <groupId>org.eclipse.recommenders.plugin</groupId>
+ <artifactId>org.eclipse.recommenders.plugin.parent</artifactId>
<version>1.0.3-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.eclipse.recommenders.completion.rcp.subwords</artifactId>
- <packaging>eclipse-plugin</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-enforcer-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-</project>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.eclipse.recommenders.completion.rcp.subwords</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/PreferencePage.java b/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/PreferencePage.java
index a3e0784..ff74dc0 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/PreferencePage.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/PreferencePage.java
@@ -88,4 +88,4 @@ public class PreferencePage extends org.eclipse.jface.preference.PreferencePage
super.setVisible(visible);
}
-} \ No newline at end of file
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsCompletionProposalComputer.java b/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsCompletionProposalComputer.java
index b39e2fe..78b4586 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsCompletionProposalComputer.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsCompletionProposalComputer.java
@@ -1,130 +1,130 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- * Paul-Emmanuel Faidherbe - Completion generalization
- */
-package org.eclipse.recommenders.internal.completion.rcp.subwords;
-
-import static org.eclipse.recommenders.internal.completion.rcp.subwords.SubwordsUtils.JDT_ALL_CATEGORY;
-import static org.eclipse.recommenders.internal.completion.rcp.subwords.SubwordsUtils.MYLYN_ALL_CATEGORY;
-import static org.eclipse.recommenders.internal.completion.rcp.subwords.SubwordsUtils.isMylynInstalled;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.CompletionContext;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.ui.PreferenceConstants;
-import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
-import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
-import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer;
-import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.recommenders.utils.rcp.internal.RecommendersUtilsPlugin;
-import org.eclipse.swt.graphics.Point;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.Sets;
-
-@SuppressWarnings({ "rawtypes", "unchecked" })
-public class SubwordsCompletionProposalComputer implements IJavaCompletionProposalComputer {
-
- private static final int TIMEOUT = 8000;
- public static String CATEGORY_ID = "org.eclipse.recommenders.subwords.rcp.category";
- private JavaContentAssistInvocationContext ctx;
-
- @Override
- public List computeCompletionProposals(final ContentAssistInvocationContext context, final IProgressMonitor monitor) {
- ctx = (JavaContentAssistInvocationContext) context;
- if (!shouldReturnResults()) return Collections.emptyList();
- return findSubwordMatchingProposals(new TimeDelimitedProgressMonitor(monitor, TIMEOUT));
- }
-
- @VisibleForTesting
- protected boolean shouldReturnResults() {
- Set<String> cats = Sets.newHashSet(PreferenceConstants.getExcludedCompletionProposalCategories());
- if (cats.contains(CATEGORY_ID)) {
- // we are excluded on default tab?
- // then we are not on default tab NOW. We are on a subsequent tab.
- // then make completions:
- return true;
- }
-
- if (isJdtAllEnabled(cats) || isMylynInstalledAndEnabled(cats)) {
- // do not compute any recommendations and deactivate yourself in background
- new DisableContentAssistCategoryJob(CATEGORY_ID).schedule(300);
- return false;
- }
- return true;
- }
-
- private boolean isMylynInstalledAndEnabled(Set<String> cats) {
- return isMylynInstalled() && !cats.contains(MYLYN_ALL_CATEGORY);
- }
-
- private boolean isJdtAllEnabled(Set<String> cats) {
- return !cats.contains(JDT_ALL_CATEGORY);
- }
-
- private String getToken() {
- CompletionContext coreCtx = ctx.getCoreContext();
- if (coreCtx == null) return "";
- final char[] token = coreCtx.getToken();
- if (token == null) {
- return "";
- }
- return String.valueOf(token);
- }
-
- private List<IJavaCompletionProposal> findSubwordMatchingProposals(IProgressMonitor monitor) {
-
- final String token = getToken();
- final SubwordsCompletionRequestor requestor = new SubwordsCompletionRequestor(token, ctx);
-
- final ITextViewer viewer = ctx.getViewer();
- final Point selection = viewer.getSelectedRange();
- if (selection.y > 0) {
- requestor.setReplacementLength(selection.y);
- }
-
- final ICompilationUnit cu = ctx.getCompilationUnit();
- final int offsetBeforeTokenBegin = ctx.getInvocationOffset() - token.length();
- try {
- // first on the original position
- cu.codeComplete(ctx.getInvocationOffset(), requestor, monitor);
- if (token.length() > 0) {
- // then on the 'virtual' position
- cu.codeComplete(offsetBeforeTokenBegin, requestor, monitor);
- }
- } catch (final Exception e) {
- RecommendersUtilsPlugin.logWarning(e, "Code completion failed: %s", e.getMessage());
- }
- return requestor.getProposals();
- }
-
- @Override
- public void sessionStarted() {
- }
-
- @Override
- public List computeContextInformation(final ContentAssistInvocationContext context, final IProgressMonitor monitor) {
- return Collections.emptyList();
- }
-
- @Override
- public String getErrorMessage() {
- return null;
- }
-
- @Override
- public void sessionEnded() {
- }
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ * Paul-Emmanuel Faidherbe - Completion generalization
+ */
+package org.eclipse.recommenders.internal.completion.rcp.subwords;
+
+import static org.eclipse.recommenders.internal.completion.rcp.subwords.SubwordsUtils.JDT_ALL_CATEGORY;
+import static org.eclipse.recommenders.internal.completion.rcp.subwords.SubwordsUtils.MYLYN_ALL_CATEGORY;
+import static org.eclipse.recommenders.internal.completion.rcp.subwords.SubwordsUtils.isMylynInstalled;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.CompletionContext;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.ui.PreferenceConstants;
+import org.eclipse.jdt.ui.text.java.ContentAssistInvocationContext;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposalComputer;
+import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.recommenders.utils.rcp.internal.RecommendersUtilsPlugin;
+import org.eclipse.swt.graphics.Point;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.Sets;
+
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class SubwordsCompletionProposalComputer implements IJavaCompletionProposalComputer {
+
+ private static final int TIMEOUT = 8000;
+ public static String CATEGORY_ID = "org.eclipse.recommenders.subwords.rcp.category";
+ private JavaContentAssistInvocationContext ctx;
+
+ @Override
+ public List computeCompletionProposals(final ContentAssistInvocationContext context, final IProgressMonitor monitor) {
+ ctx = (JavaContentAssistInvocationContext) context;
+ if (!shouldReturnResults()) return Collections.emptyList();
+ return findSubwordMatchingProposals(new TimeDelimitedProgressMonitor(monitor, TIMEOUT));
+ }
+
+ @VisibleForTesting
+ protected boolean shouldReturnResults() {
+ Set<String> cats = Sets.newHashSet(PreferenceConstants.getExcludedCompletionProposalCategories());
+ if (cats.contains(CATEGORY_ID)) {
+ // we are excluded on default tab?
+ // then we are not on default tab NOW. We are on a subsequent tab.
+ // then make completions:
+ return true;
+ }
+
+ if (isJdtAllEnabled(cats) || isMylynInstalledAndEnabled(cats)) {
+ // do not compute any recommendations and deactivate yourself in background
+ new DisableContentAssistCategoryJob(CATEGORY_ID).schedule(300);
+ return false;
+ }
+ return true;
+ }
+
+ private boolean isMylynInstalledAndEnabled(Set<String> cats) {
+ return isMylynInstalled() && !cats.contains(MYLYN_ALL_CATEGORY);
+ }
+
+ private boolean isJdtAllEnabled(Set<String> cats) {
+ return !cats.contains(JDT_ALL_CATEGORY);
+ }
+
+ private String getToken() {
+ CompletionContext coreCtx = ctx.getCoreContext();
+ if (coreCtx == null) return "";
+ final char[] token = coreCtx.getToken();
+ if (token == null) {
+ return "";
+ }
+ return String.valueOf(token);
+ }
+
+ private List<IJavaCompletionProposal> findSubwordMatchingProposals(IProgressMonitor monitor) {
+
+ final String token = getToken();
+ final SubwordsCompletionRequestor requestor = new SubwordsCompletionRequestor(token, ctx);
+
+ final ITextViewer viewer = ctx.getViewer();
+ final Point selection = viewer.getSelectedRange();
+ if (selection.y > 0) {
+ requestor.setReplacementLength(selection.y);
+ }
+
+ final ICompilationUnit cu = ctx.getCompilationUnit();
+ final int offsetBeforeTokenBegin = ctx.getInvocationOffset() - token.length();
+ try {
+ // first on the original position
+ cu.codeComplete(ctx.getInvocationOffset(), requestor, monitor);
+ if (token.length() > 0) {
+ // then on the 'virtual' position
+ cu.codeComplete(offsetBeforeTokenBegin, requestor, monitor);
+ }
+ } catch (final Exception e) {
+ RecommendersUtilsPlugin.logWarning(e, "Code completion failed: %s", e.getMessage());
+ }
+ return requestor.getProposals();
+ }
+
+ @Override
+ public void sessionStarted() {
+ }
+
+ @Override
+ public List computeContextInformation(final ContentAssistInvocationContext context, final IProgressMonitor monitor) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public String getErrorMessage() {
+ return null;
+ }
+
+ @Override
+ public void sessionEnded() {
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsCompletionRequestor.java b/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsCompletionRequestor.java
index 9b6ef30..5d04c43 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsCompletionRequestor.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsCompletionRequestor.java
@@ -1,218 +1,218 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Marcel Bruch - initial API and implementation.
- */
-package org.eclipse.recommenders.internal.completion.rcp.subwords;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.eclipse.jdt.core.CompletionProposal.ANNOTATION_ATTRIBUTE_REF;
-import static org.eclipse.jdt.core.CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION;
-import static org.eclipse.jdt.core.CompletionProposal.ANONYMOUS_CLASS_DECLARATION;
-import static org.eclipse.jdt.core.CompletionProposal.CONSTRUCTOR_INVOCATION;
-import static org.eclipse.jdt.core.CompletionProposal.FIELD_IMPORT;
-import static org.eclipse.jdt.core.CompletionProposal.FIELD_REF;
-import static org.eclipse.jdt.core.CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER;
-import static org.eclipse.jdt.core.CompletionProposal.KEYWORD;
-import static org.eclipse.jdt.core.CompletionProposal.LABEL_REF;
-import static org.eclipse.jdt.core.CompletionProposal.LOCAL_VARIABLE_REF;
-import static org.eclipse.jdt.core.CompletionProposal.METHOD_DECLARATION;
-import static org.eclipse.jdt.core.CompletionProposal.METHOD_IMPORT;
-import static org.eclipse.jdt.core.CompletionProposal.METHOD_NAME_REFERENCE;
-import static org.eclipse.jdt.core.CompletionProposal.METHOD_REF;
-import static org.eclipse.jdt.core.CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER;
-import static org.eclipse.jdt.core.CompletionProposal.PACKAGE_REF;
-import static org.eclipse.jdt.core.CompletionProposal.POTENTIAL_METHOD_DECLARATION;
-import static org.eclipse.jdt.core.CompletionProposal.TYPE_IMPORT;
-import static org.eclipse.jdt.core.CompletionProposal.TYPE_REF;
-import static org.eclipse.jdt.core.CompletionProposal.VARIABLE_DECLARATION;
-import static org.eclipse.recommenders.internal.completion.rcp.subwords.SubwordsUtils.getTokensBetweenLastWhitespaceAndFirstOpeningBracket;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.lang3.ArrayUtils;
-import org.eclipse.jdt.core.CompletionContext;
-import org.eclipse.jdt.core.CompletionProposal;
-import org.eclipse.jdt.core.CompletionRequestor;
-import org.eclipse.jdt.internal.ui.text.java.FillArgumentNamesCompletionProposalCollector;
-import org.eclipse.jdt.ui.PreferenceConstants;
-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.recommenders.internal.completion.rcp.subwords.proposals.ProposalFactory;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-public class SubwordsCompletionRequestor extends CompletionRequestor {
-
- private final List<IJavaCompletionProposal> proposals = Lists.newLinkedList();
-
- private final Set<String> duplicates = Sets.newHashSet();
- private final JavaContentAssistInvocationContext ctx;
-
- private final CompletionProposalCollector collector;
-
- private final String prefix;
-
- public SubwordsCompletionRequestor(final String prefix, final JavaContentAssistInvocationContext ctx) {
- super(false);
- checkNotNull(prefix);
- checkNotNull(ctx);
- this.prefix = prefix;
- this.ctx = ctx;
-
- if (shouldFillArgumentNames()) {
- collector = new FillArgumentNamesCompletionProposalCollector(ctx);
- } else {
- collector = new CompletionProposalCollector(ctx.getCompilationUnit(), false);
- }
-
- // this.collector = new CompletionProposalCollector(ctx.getCompilationUnit());
- this.collector.acceptContext(ctx.getCoreContext());
- this.collector.setInvocationContext(ctx);
- collector.setIgnored(ANNOTATION_ATTRIBUTE_REF, false);
- collector.setIgnored(ANONYMOUS_CLASS_DECLARATION, false);
- collector.setIgnored(ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION, false);
- collector.setIgnored(FIELD_REF, false);
- collector.setIgnored(FIELD_REF_WITH_CASTED_RECEIVER, false);
- collector.setIgnored(KEYWORD, false);
- collector.setIgnored(LABEL_REF, false);
- collector.setIgnored(LOCAL_VARIABLE_REF, false);
- collector.setIgnored(METHOD_DECLARATION, false);
- collector.setIgnored(METHOD_NAME_REFERENCE, false);
- collector.setIgnored(METHOD_REF, false);
- collector.setIgnored(CONSTRUCTOR_INVOCATION, false);
- collector.setIgnored(METHOD_REF_WITH_CASTED_RECEIVER, false);
- collector.setIgnored(PACKAGE_REF, false);
- collector.setIgnored(POTENTIAL_METHOD_DECLARATION, false);
- collector.setIgnored(VARIABLE_DECLARATION, false);
- collector.setIgnored(TYPE_REF, false);
-
- collector.setAllowsRequiredProposals(FIELD_REF, TYPE_REF, true);
- collector.setAllowsRequiredProposals(FIELD_REF, TYPE_IMPORT, true);
- collector.setAllowsRequiredProposals(FIELD_REF, FIELD_IMPORT, true);
- collector.setAllowsRequiredProposals(METHOD_REF, TYPE_REF, true);
- collector.setAllowsRequiredProposals(METHOD_REF, TYPE_IMPORT, true);
- collector.setAllowsRequiredProposals(METHOD_REF, METHOD_IMPORT, true);
- collector.setAllowsRequiredProposals(CONSTRUCTOR_INVOCATION, TYPE_REF, true);
- collector.setAllowsRequiredProposals(ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION, TYPE_REF, true);
- collector.setAllowsRequiredProposals(ANONYMOUS_CLASS_DECLARATION, TYPE_REF, true);
- collector.setAllowsRequiredProposals(TYPE_REF, TYPE_REF, true);
-
- collector.setFavoriteReferences(getFavoriteStaticMembers());
- collector.setRequireExtendedContext(true);
- }
-
- @VisibleForTesting
- protected boolean shouldFillArgumentNames() {
- try {
- // when running a test suite this throws a NPE
- return PreferenceConstants.getPreferenceStore()
- .getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES);
- } catch (final Exception e) {
- return true;
- }
- }
-
- @Override
- public boolean isAllowingRequiredProposals(final int proposalKind, final int requiredProposalKind) {
- boolean isAllowed = collector.isAllowingRequiredProposals(proposalKind, requiredProposalKind);
- return isAllowed;
- };
-
- @Override
- public boolean isIgnored(final int completionProposalKind) {
- boolean ignored = collector.isIgnored(completionProposalKind);
- return ignored;
- };
-
- @Override
- public void acceptContext(final CompletionContext context) {
- super.acceptContext(context);
- collector.acceptContext(context);
- }
-
- @Override
- public boolean isExtendedContextRequired() {
- return collector.isExtendedContextRequired();
- }
-
- private String[] getFavoriteStaticMembers() {
- final String serializedFavorites =
- PreferenceConstants.getPreferenceStore()
- .getString(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS);
- if (serializedFavorites != null && serializedFavorites.length() > 0) {
- return serializedFavorites.split(";"); //$NON-NLS-1$
- }
- return new String[0];
- }
-
- @Override
- public void accept(final CompletionProposal proposal) {
- if (isDuplicate(proposal)) {
- return;
- }
-
- final String subwordsMatchingRegion = getTokensBetweenLastWhitespaceAndFirstOpeningBracket(proposal);
-
- if (!subwordsMatchingRegion.isEmpty() && !LCSS.containsSubsequence(subwordsMatchingRegion, prefix)) {
- return;
- }
-
- for (final IJavaCompletionProposal p : tryCreateJdtProposal(proposal)) {
- final SubwordsProposalContext subwordsContext = new SubwordsProposalContext(prefix, proposal, p, ctx);
- createSubwordsProposal(subwordsContext);
- }
- }
-
- private boolean isDuplicate(final CompletionProposal proposal) {
- final StringBuilder sb = new StringBuilder();
-
- final char[] c = proposal.getCompletion();
- sb.append(c);
- final char[] d = proposal.getDeclarationSignature();
- if (d != null) {
- sb.append(d);
- }
- final char[] s = proposal.getSignature();
- if (s != null) {
- sb.append(s);
- }
- final String key = sb.toString();
- return !duplicates.add(key);
- }
-
- private IJavaCompletionProposal[] tryCreateJdtProposal(final CompletionProposal proposal) {
- final int oldLength = collector.getJavaCompletionProposals().length;
- collector.accept(proposal);
- // order matters ;)
- final IJavaCompletionProposal[] jdtProposals = collector.getJavaCompletionProposals();
- final IJavaCompletionProposal[] newProposals =
- ArrayUtils.subarray(jdtProposals, oldLength, jdtProposals.length);
- return newProposals;
- }
-
- private void createSubwordsProposal(final SubwordsProposalContext subwordsContext) {
- final IJavaCompletionProposal subWordProposal = ProposalFactory.createFromJDTProposal(subwordsContext);
- if (subWordProposal != null) {
- // subWordProposal.setRelevance(subwordsContext.calculateRelevance());
- proposals.add(subWordProposal);
- }
- }
-
- public List<IJavaCompletionProposal> getProposals() {
- return proposals;
- }
-
- public void setReplacementLength(final int y) {
- collector.setReplacementLength(y);
- }
-} \ No newline at end of file
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Marcel Bruch - initial API and implementation.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.subwords;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.eclipse.jdt.core.CompletionProposal.ANNOTATION_ATTRIBUTE_REF;
+import static org.eclipse.jdt.core.CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION;
+import static org.eclipse.jdt.core.CompletionProposal.ANONYMOUS_CLASS_DECLARATION;
+import static org.eclipse.jdt.core.CompletionProposal.CONSTRUCTOR_INVOCATION;
+import static org.eclipse.jdt.core.CompletionProposal.FIELD_IMPORT;
+import static org.eclipse.jdt.core.CompletionProposal.FIELD_REF;
+import static org.eclipse.jdt.core.CompletionProposal.FIELD_REF_WITH_CASTED_RECEIVER;
+import static org.eclipse.jdt.core.CompletionProposal.KEYWORD;
+import static org.eclipse.jdt.core.CompletionProposal.LABEL_REF;
+import static org.eclipse.jdt.core.CompletionProposal.LOCAL_VARIABLE_REF;
+import static org.eclipse.jdt.core.CompletionProposal.METHOD_DECLARATION;
+import static org.eclipse.jdt.core.CompletionProposal.METHOD_IMPORT;
+import static org.eclipse.jdt.core.CompletionProposal.METHOD_NAME_REFERENCE;
+import static org.eclipse.jdt.core.CompletionProposal.METHOD_REF;
+import static org.eclipse.jdt.core.CompletionProposal.METHOD_REF_WITH_CASTED_RECEIVER;
+import static org.eclipse.jdt.core.CompletionProposal.PACKAGE_REF;
+import static org.eclipse.jdt.core.CompletionProposal.POTENTIAL_METHOD_DECLARATION;
+import static org.eclipse.jdt.core.CompletionProposal.TYPE_IMPORT;
+import static org.eclipse.jdt.core.CompletionProposal.TYPE_REF;
+import static org.eclipse.jdt.core.CompletionProposal.VARIABLE_DECLARATION;
+import static org.eclipse.recommenders.internal.completion.rcp.subwords.SubwordsUtils.getTokensBetweenLastWhitespaceAndFirstOpeningBracket;
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.lang3.ArrayUtils;
+import org.eclipse.jdt.core.CompletionContext;
+import org.eclipse.jdt.core.CompletionProposal;
+import org.eclipse.jdt.core.CompletionRequestor;
+import org.eclipse.jdt.internal.ui.text.java.FillArgumentNamesCompletionProposalCollector;
+import org.eclipse.jdt.ui.PreferenceConstants;
+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.recommenders.internal.completion.rcp.subwords.proposals.ProposalFactory;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+public class SubwordsCompletionRequestor extends CompletionRequestor {
+
+ private final List<IJavaCompletionProposal> proposals = Lists.newLinkedList();
+
+ private final Set<String> duplicates = Sets.newHashSet();
+ private final JavaContentAssistInvocationContext ctx;
+
+ private final CompletionProposalCollector collector;
+
+ private final String prefix;
+
+ public SubwordsCompletionRequestor(final String prefix, final JavaContentAssistInvocationContext ctx) {
+ super(false);
+ checkNotNull(prefix);
+ checkNotNull(ctx);
+ this.prefix = prefix;
+ this.ctx = ctx;
+
+ if (shouldFillArgumentNames()) {
+ collector = new FillArgumentNamesCompletionProposalCollector(ctx);
+ } else {
+ collector = new CompletionProposalCollector(ctx.getCompilationUnit(), false);
+ }
+
+ // this.collector = new CompletionProposalCollector(ctx.getCompilationUnit());
+ this.collector.acceptContext(ctx.getCoreContext());
+ this.collector.setInvocationContext(ctx);
+ collector.setIgnored(ANNOTATION_ATTRIBUTE_REF, false);
+ collector.setIgnored(ANONYMOUS_CLASS_DECLARATION, false);
+ collector.setIgnored(ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION, false);
+ collector.setIgnored(FIELD_REF, false);
+ collector.setIgnored(FIELD_REF_WITH_CASTED_RECEIVER, false);
+ collector.setIgnored(KEYWORD, false);
+ collector.setIgnored(LABEL_REF, false);
+ collector.setIgnored(LOCAL_VARIABLE_REF, false);
+ collector.setIgnored(METHOD_DECLARATION, false);
+ collector.setIgnored(METHOD_NAME_REFERENCE, false);
+ collector.setIgnored(METHOD_REF, false);
+ collector.setIgnored(CONSTRUCTOR_INVOCATION, false);
+ collector.setIgnored(METHOD_REF_WITH_CASTED_RECEIVER, false);
+ collector.setIgnored(PACKAGE_REF, false);
+ collector.setIgnored(POTENTIAL_METHOD_DECLARATION, false);
+ collector.setIgnored(VARIABLE_DECLARATION, false);
+ collector.setIgnored(TYPE_REF, false);
+
+ collector.setAllowsRequiredProposals(FIELD_REF, TYPE_REF, true);
+ collector.setAllowsRequiredProposals(FIELD_REF, TYPE_IMPORT, true);
+ collector.setAllowsRequiredProposals(FIELD_REF, FIELD_IMPORT, true);
+ collector.setAllowsRequiredProposals(METHOD_REF, TYPE_REF, true);
+ collector.setAllowsRequiredProposals(METHOD_REF, TYPE_IMPORT, true);
+ collector.setAllowsRequiredProposals(METHOD_REF, METHOD_IMPORT, true);
+ collector.setAllowsRequiredProposals(CONSTRUCTOR_INVOCATION, TYPE_REF, true);
+ collector.setAllowsRequiredProposals(ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION, TYPE_REF, true);
+ collector.setAllowsRequiredProposals(ANONYMOUS_CLASS_DECLARATION, TYPE_REF, true);
+ collector.setAllowsRequiredProposals(TYPE_REF, TYPE_REF, true);
+
+ collector.setFavoriteReferences(getFavoriteStaticMembers());
+ collector.setRequireExtendedContext(true);
+ }
+
+ @VisibleForTesting
+ protected boolean shouldFillArgumentNames() {
+ try {
+ // when running a test suite this throws a NPE
+ return PreferenceConstants.getPreferenceStore()
+ .getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES);
+ } catch (final Exception e) {
+ return true;
+ }
+ }
+
+ @Override
+ public boolean isAllowingRequiredProposals(final int proposalKind, final int requiredProposalKind) {
+ boolean isAllowed = collector.isAllowingRequiredProposals(proposalKind, requiredProposalKind);
+ return isAllowed;
+ };
+
+ @Override
+ public boolean isIgnored(final int completionProposalKind) {
+ boolean ignored = collector.isIgnored(completionProposalKind);
+ return ignored;
+ };
+
+ @Override
+ public void acceptContext(final CompletionContext context) {
+ super.acceptContext(context);
+ collector.acceptContext(context);
+ }
+
+ @Override
+ public boolean isExtendedContextRequired() {
+ return collector.isExtendedContextRequired();
+ }
+
+ private String[] getFavoriteStaticMembers() {
+ final String serializedFavorites =
+ PreferenceConstants.getPreferenceStore()
+ .getString(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS);
+ if (serializedFavorites != null && serializedFavorites.length() > 0) {
+ return serializedFavorites.split(";"); //$NON-NLS-1$
+ }
+ return new String[0];
+ }
+
+ @Override
+ public void accept(final CompletionProposal proposal) {
+ if (isDuplicate(proposal)) {
+ return;
+ }
+
+ final String subwordsMatchingRegion = getTokensBetweenLastWhitespaceAndFirstOpeningBracket(proposal);
+
+ if (!subwordsMatchingRegion.isEmpty() && !LCSS.containsSubsequence(subwordsMatchingRegion, prefix)) {
+ return;
+ }
+
+ for (final IJavaCompletionProposal p : tryCreateJdtProposal(proposal)) {
+ final SubwordsProposalContext subwordsContext = new SubwordsProposalContext(prefix, proposal, p, ctx);
+ createSubwordsProposal(subwordsContext);
+ }
+ }
+
+ private boolean isDuplicate(final CompletionProposal proposal) {
+ final StringBuilder sb = new StringBuilder();
+
+ final char[] c = proposal.getCompletion();
+ sb.append(c);
+ final char[] d = proposal.getDeclarationSignature();
+ if (d != null) {
+ sb.append(d);
+ }
+ final char[] s = proposal.getSignature();
+ if (s != null) {
+ sb.append(s);
+ }
+ final String key = sb.toString();
+ return !duplicates.add(key);
+ }
+
+ private IJavaCompletionProposal[] tryCreateJdtProposal(final CompletionProposal proposal) {
+ final int oldLength = collector.getJavaCompletionProposals().length;
+ collector.accept(proposal);
+ // order matters ;)
+ final IJavaCompletionProposal[] jdtProposals = collector.getJavaCompletionProposals();
+ final IJavaCompletionProposal[] newProposals =
+ ArrayUtils.subarray(jdtProposals, oldLength, jdtProposals.length);
+ return newProposals;
+ }
+
+ private void createSubwordsProposal(final SubwordsProposalContext subwordsContext) {
+ final IJavaCompletionProposal subWordProposal = ProposalFactory.createFromJDTProposal(subwordsContext);
+ if (subWordProposal != null) {
+ // subWordProposal.setRelevance(subwordsContext.calculateRelevance());
+ proposals.add(subWordProposal);
+ }
+ }
+
+ public List<IJavaCompletionProposal> getProposals() {
+ return proposals;
+ }
+
+ public void setReplacementLength(final int y) {
+ collector.setReplacementLength(y);
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsProposalContext.java b/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsProposalContext.java
index 2cd9977..b232415 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsProposalContext.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsProposalContext.java
@@ -1,101 +1,101 @@
-/**
- * Copyright (c) 2010 Darmstadt University of Technology.
- * 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:
- * Johannes Lerch - initial API and implementation.
- * Marcel Bruch - added support for matching and scoring subsequences.
- */
-package org.eclipse.recommenders.internal.completion.rcp.subwords;
-
-import static org.apache.commons.lang3.StringUtils.getCommonPrefix;
-import static org.eclipse.recommenders.utils.Checks.ensureIsNotNull;
-
-import org.eclipse.jdt.core.CompletionProposal;
-import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
-import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
-import org.eclipse.jface.preference.JFacePreferences;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.StyledString;
-import org.eclipse.jface.viewers.StyledString.Styler;
-import org.eclipse.recommenders.utils.rcp.RCPUtils;
-import org.eclipse.swt.graphics.TextStyle;
-
-public class SubwordsProposalContext {
-
- public static final int PREFIX_BONUS = 5000;
-
- private static Styler BIGRAMS_STYLER = new Styler() {
- @Override
- public void applyStyles(final TextStyle textStyle) {
- textStyle.foreground = JFaceResources.getColorRegistry().get(JFacePreferences.COUNTER_COLOR);
- }
- };
-
- private String prefix;
- private final String subwordsMatchingRegion;
- private final IJavaCompletionProposal jdtProposal;
- private final CompletionProposal proposal;
- private final JavaContentAssistInvocationContext ctx;
-
- private int[] bestSubsequence;
- private int bestSubsequenceScore;
-
- public SubwordsProposalContext(final String prefix, final CompletionProposal proposal,
- final IJavaCompletionProposal jdtProposal, final JavaContentAssistInvocationContext ctx) {
- this.proposal = proposal;
- this.ctx = ctx;
- this.subwordsMatchingRegion =
- SubwordsUtils.getTokensBetweenLastWhitespaceAndFirstOpeningBracket(jdtProposal.getDisplayString());
- this.jdtProposal = jdtProposal;
- setPrefix(prefix);
- }
-
- @SuppressWarnings("unchecked")
- public <T extends IJavaCompletionProposal> T getJdtProposal() {
- return (T) jdtProposal;
- }
-
- public CompletionProposal getProposal() {
- return proposal;
- }
-
- public JavaContentAssistInvocationContext getContext() {
- return ctx;
- }
-
- public void setPrefix(final String prefix) {
- this.prefix = ensureIsNotNull(prefix);
- bestSubsequence = LCSS.bestSubsequence(subwordsMatchingRegion, prefix);
- bestSubsequenceScore = LCSS.scoreSubsequence(bestSubsequence);
- }
-
- public StyledString getStyledDisplayString(final StyledString origin) {
- final StyledString copy = RCPUtils.deepCopy(origin);
- for (int index : bestSubsequence)
- copy.setStyle(index, 1, BIGRAMS_STYLER);
- return copy;
- }
-
- public boolean isPrefixMatch() {
- return subwordsMatchingRegion.startsWith(prefix);
- }
-
- public int calculateRelevance() {
- String commonPrefix = getCommonPrefix(subwordsMatchingRegion.toLowerCase(), prefix.toLowerCase());
- int score = 0;
- if (commonPrefix.length() == prefix.length()) {
- // complete prefix match
- score += 200;
- }
- int relevance = jdtProposal.getRelevance() + score + bestSubsequenceScore;
- return relevance;
- }
-
- public boolean isRegexMatch() {
- return LCSS.containsSubsequence(subwordsMatchingRegion, prefix);
- }
-}
+/**
+ * Copyright (c) 2010 Darmstadt University of Technology.
+ * 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:
+ * Johannes Lerch - initial API and implementation.
+ * Marcel Bruch - added support for matching and scoring subsequences.
+ */
+package org.eclipse.recommenders.internal.completion.rcp.subwords;
+
+import static org.apache.commons.lang3.StringUtils.getCommonPrefix;
+import static org.eclipse.recommenders.utils.Checks.ensureIsNotNull;
+
+import org.eclipse.jdt.core.CompletionProposal;
+import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
+import org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext;
+import org.eclipse.jface.preference.JFacePreferences;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.StyledString;
+import org.eclipse.jface.viewers.StyledString.Styler;
+import org.eclipse.recommenders.utils.rcp.RCPUtils;
+import org.eclipse.swt.graphics.TextStyle;
+
+public class SubwordsProposalContext {
+
+ public static final int PREFIX_BONUS = 5000;
+
+ private static Styler BIGRAMS_STYLER = new Styler() {
+ @Override
+ public void applyStyles(final TextStyle textStyle) {
+ textStyle.foreground = JFaceResources.getColorRegistry().get(JFacePreferences.COUNTER_COLOR);
+ }
+ };
+
+ private String prefix;
+ private final String subwordsMatchingRegion;
+ private final IJavaCompletionProposal jdtProposal;
+ private final CompletionProposal proposal;
+ private final JavaContentAssistInvocationContext ctx;
+
+ private int[] bestSubsequence;
+ private int bestSubsequenceScore;
+
+ public SubwordsProposalContext(final String prefix, final CompletionProposal proposal,
+ final IJavaCompletionProposal jdtProposal, final JavaContentAssistInvocationContext ctx) {
+ this.proposal = proposal;
+ this.ctx = ctx;
+ this.subwordsMatchingRegion =
+ SubwordsUtils.getTokensBetweenLastWhitespaceAndFirstOpeningBracket(jdtProposal.getDisplayString());
+ this.jdtProposal = jdtProposal;
+ setPrefix(prefix);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends IJavaCompletionProposal> T getJdtProposal() {
+ return (T) jdtProposal;
+ }
+
+ public CompletionProposal getProposal() {
+ return proposal;
+ }
+
+ public JavaContentAssistInvocationContext getContext() {
+ return ctx;
+ }
+
+ public void setPrefix(final String prefix) {
+ this.prefix = ensureIsNotNull(prefix);
+ bestSubsequence = LCSS.bestSubsequence(subwordsMatchingRegion, prefix);
+ bestSubsequenceScore = LCSS.scoreSubsequence(bestSubsequence);
+ }
+
+ public StyledString getStyledDisplayString(final StyledString origin) {
+ final StyledString copy = RCPUtils.deepCopy(origin);
+ for (int index : bestSubsequence)
+ copy.setStyle(index, 1, BIGRAMS_STYLER);
+ return copy;
+ }
+
+ public boolean isPrefixMatch() {
+ return subwordsMatchingRegion.startsWith(prefix);
+ }
+
+ public int calculateRelevance() {
+ String commonPrefix = getCommonPrefix(subwordsMatchingRegion.toLowerCase(), prefix.toLowerCase());
+ int score = 0;
+ if (commonPrefix.length() == prefix.length()) {
+ // complete prefix match
+ score += 200;
+ }
+ int relevance = jdtProposal.getRelevance() + score + bestSubsequenceScore;
+ return relevance;
+ }
+
+ public boolean isRegexMatch() {
+ return LCSS.containsSubsequence(subwordsMatchingRegion, prefix);
+ }
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsUtils.java b/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsUtils.java
index f733dc5..fafb50d 100644
--- a/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsUtils.java
+++ b/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/SubwordsUtils.java
@@ -1,66 +1,66 @@
-/**
- * Copyright (c) 2011 Paul-Emmanuel Faidherbe.
- * 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:
- * Paul-Emmanuel Faidherbe - Completion proposals relevance benchmark
- * Johannes Lerch, Marcel Bruch - Added utility functions for proposal generation
- */
-package org.eclipse.recommenders.internal.completion.rcp.subwords;
-
-import java.util.Arrays;
-
-import org.apache.commons.lang3.StringUtils;
-import org.eclipse.jdt.core.CompletionProposal;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory;
-import org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerRegistry;
-
-public class SubwordsUtils {
- static final String JDT_ALL_CATEGORY = "org.eclipse.jdt.ui.javaAllProposalCategory";
- static final String MYLYN_ALL_CATEGORY = "org.eclipse.mylyn.java.ui.javaAllProposalCategory";
-
- public static String getTokensBetweenLastWhitespaceAndFirstOpeningBracket(final CompletionProposal proposal) {
- boolean isPotentialMethodDecl = proposal.getKind() == CompletionProposal.POTENTIAL_METHOD_DECLARATION;
- char[] token = proposal.getCompletion();
- if (Arrays.equals(token, new char[] { '(', ')' })) {
- token = proposal.getName();
- } else if (isPotentialMethodDecl && proposal.getCompletion().length == 0) {
- char[] signature = proposal.getDeclarationSignature();
- char[] typeName = Signature.getSignatureSimpleName(signature);
- return String.valueOf(typeName);
- }
- return getTokensBetweenLastWhitespaceAndFirstOpeningBracket(String.valueOf(token));
- }
-
- public static String getTokensBetweenLastWhitespaceAndFirstOpeningBracket(String completion) {
- if (completion.contains("(")) {
- completion = getMethodIdentifierFromProposalText(completion);
- } else {
- completion = StringUtils.substringBefore(completion, " ");
- }
- return completion;
- }
-
- private static String getMethodIdentifierFromProposalText(String completion) {
- completion = StringUtils.substringBefore(completion, "(");
- if (completion.contains(" ")) {
- completion = StringUtils.substringAfterLast(completion, " ");
- }
- return completion;
- }
-
- public static boolean isMylynInstalled() {
- CompletionProposalComputerRegistry reg = CompletionProposalComputerRegistry.getDefault();
- for (CompletionProposalCategory cat : reg.getProposalCategories()) {
- if (cat.getId().equals(MYLYN_ALL_CATEGORY)) {
- return true;
- }
- }
- return false;
- }
-
-}
+/**
+ * Copyright (c) 2011 Paul-Emmanuel Faidherbe.
+ * 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:
+ * Paul-Emmanuel Faidherbe - Completion proposals relevance benchmark
+ * Johannes Lerch, Marcel Bruch - Added utility functions for proposal generation
+ */
+package org.eclipse.recommenders.internal.completion.rcp.subwords;
+
+import java.util.Arrays;
+
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jdt.core.CompletionProposal;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory;
+import org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerRegistry;
+
+public class SubwordsUtils {
+ static final String JDT_ALL_CATEGORY = "org.eclipse.jdt.ui.javaAllProposalCategory";
+ static final String MYLYN_ALL_CATEGORY = "org.eclipse.mylyn.java.ui.javaAllProposalCategory";
+
+ public static String getTokensBetweenLastWhitespaceAndFirstOpeningBracket(final CompletionProposal proposal) {
+ boolean isPotentialMethodDecl = proposal.getKind() == CompletionProposal.POTENTIAL_METHOD_DECLARATION;
+ char[] token = proposal.getCompletion();
+ if (Arrays.equals(token, new char[] { '(', ')' })) {
+ token = proposal.getName();
+ } else if (isPotentialMethodDecl && proposal.getCompletion().length == 0) {
+ char[] signature = proposal.getDeclarationSignature();
+ char[] typeName = Signature.getSignatureSimpleName(signature);
+ return String.valueOf(typeName);
+ }
+ return getTokensBetweenLastWhitespaceAndFirstOpeningBracket(String.valueOf(token));
+ }
+
+ public static String getTokensBetweenLastWhitespaceAndFirstOpeningBracket(String completion) {
+ if (completion.contains("(")) {
+ completion = getMethodIdentifierFromProposalText(completion);
+ } else {
+ completion = StringUtils.substringBefore(completion, " ");
+ }
+ return completion;
+ }
+
+ private static String getMethodIdentifierFromProposalText(String completion) {
+ completion = StringUtils.substringBefore(completion, "(");
+ if (completion.contains(" ")) {
+ completion = StringUtils.substringAfterLast(completion, " ");
+ }
+ return completion;
+ }
+
+ public static boolean isMylynInstalled() {
+ CompletionProposalComputerRegistry reg = CompletionProposalComputerRegistry.getDefault();
+ for (CompletionProposalCategory cat : reg.getProposalCategories()) {
+ if (cat.getId().equals(MYLYN_ALL_CATEGORY)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.recommenders.completion.rcp.subwords/src/org/eclipse/recommenders/internal/completion/rcp/subwords/proposals/ProposalFactory.java b/plugins/org.eclipse.recom