Skip to content
Snippets Groups Projects
Commit e4bdee5c authored by Simon Barner's avatar Simon Barner
Browse files

YELLOW

Use more meaningful and consistent names.
refs 2983
parent 554491fc
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,7 @@ import org.osgi.framework.Bundle;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating RED Hash: 969C09685510F14D66CFB9033A1CD405
* @ConQAT.Rating YELLOW Hash: 0D786B30091245516387B38B30C5828E
*/
public class ContextMenuService implements IContextMenuService, IIntrospectiveKernelService {
/** The singleton service instance. */
......@@ -76,10 +76,8 @@ public class ContextMenuService implements IContextMenuService, IIntrospectiveKe
/** The model element handler class attribute name. */
private static final String HANDLER_CLASS_ATTRIBUTE_NAME = "contributor";
// TODO(VA) I think the following comment is wrong: it's not about prototypes here, see below as
// well.
/** Stores the registered prototype providers. */
private final List<IContextMenuContributor> providerList =
/** Stores the registered context menu contributors. */
private final List<IContextMenuContributor> contextMenuContributorList =
new ArrayList<IContextMenuContributor>();
/** Initializes the service. */
......@@ -89,14 +87,14 @@ public class ContextMenuService implements IContextMenuService, IIntrospectiveKe
/** Starts the service. */
public void startService() {
setupProviders();
setupContextMenuContributors();
IKernelIntrospectionSystemService.getInstance().registerService(this);
}
/** Registers the given contributor with the service. */
/** Registers the given context menu contributor with the service. */
@Override
public void registerContextMenuContributor(IContextMenuContributor contributor) {
providerList.add(contributor);
contextMenuContributorList.add(contributor);
}
/** {@inheritDoc} */
......@@ -120,8 +118,8 @@ public class ContextMenuService implements IContextMenuService, IIntrospectiveKe
return menuManager;
}
/** Initializes the prototype list from plugin extensions. */
private void setupProviders() {
/** Initializes the context menu contributors from plugin extensions. */
private void setupContextMenuContributors() {
for(IConfigurationElement ce : ExtensionPointUtils.getConfigurationElements(
EXTENSION_POINT_NAME, CONFIGURATION_ELEMENT_NAME)) {
Bundle bundle = ExtensionPointUtils.getBundle(ce);
......@@ -130,9 +128,9 @@ public class ContextMenuService implements IContextMenuService, IIntrospectiveKe
ExtensionPointUtils.loadClass(
ce.getAttribute(HANDLER_CLASS_ATTRIBUTE_NAME), bundle);
IContextMenuContributor provider =
IContextMenuContributor contextMenuContributor =
(IContextMenuContributor)handlerClass.getConstructor().newInstance();
providerList.add(provider);
contextMenuContributorList.add(contextMenuContributor);
} catch(Exception ex) {
LoggingUtils.error(ToolingKernelActivator.getDefault(), ex.getMessage(), ex);
}
......@@ -195,7 +193,7 @@ public class ContextMenuService implements IContextMenuService, IIntrospectiveKe
private void singleSelectionElementContributions(IMenuManager menu,
ContextMenuContextProvider contextProvider) {
EObject selectionElem = contextProvider.getSelectedModelElement();
for(IContextMenuContributor contributor : providerList) {
for(IContextMenuContributor contributor : contextMenuContributorList) {
String menuSectionID = contributor.getMenuSectionID();
if(menuSectionID == null) {
menuSectionID = IWorkbenchActionConstants.MB_ADDITIONS;
......@@ -229,7 +227,7 @@ public class ContextMenuService implements IContextMenuService, IIntrospectiveKe
/** Populates the menu with contributions to multiple model element selection. */
private void addMultiSelectionContributions(IMenuManager menu,
ContextMenuContextProvider contextProvider, List<EObject> selection) {
for(IContextMenuContributor contributor : providerList) {
for(IContextMenuContributor contributor : contextMenuContributorList) {
if(contributor instanceof IContextMenuMultiSelectionContributor) {
IContextMenuMultiSelectionContributor multicontributor =
(IContextMenuMultiSelectionContributor)contributor;
......@@ -286,6 +284,6 @@ public class ContextMenuService implements IContextMenuService, IIntrospectiveKe
/** {@inheritDoc} */
@Override
public IIntrospectionDetailsItem getDetailsItem() {
return new ContextMenuServiceIntrospectionDetailsItem(providerList);
return new ContextMenuServiceIntrospectionDetailsItem(contextMenuContributorList);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment