Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
kernel
Commits
e4bdee5c
Commit
e4bdee5c
authored
Nov 17, 2017
by
Simon Barner
Browse files
YELLOW
Use more meaningful and consistent names. refs 2983
parent
554491fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ContextMenuService.java
View file @
e4bdee5c
...
...
@@ -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
()
{
setup
Provide
rs
();
setup
ContextMenuContributo
rs
();
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
)
{
provide
rList
.
add
(
contributor
);
contextMenuContributo
rList
.
add
(
contributor
);
}
/** {@inheritDoc} */
...
...
@@ -120,8 +118,8 @@ public class ContextMenuService implements IContextMenuService, IIntrospectiveKe
return
menuManager
;
}
/** Initializes the
prototype list
from plugin extensions. */
private
void
setup
Provide
rs
()
{
/** Initializes the
context menu contributors
from plugin extensions. */
private
void
setup
ContextMenuContributo
rs
()
{
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
provide
r
=
IContextMenuContributor
contextMenuContributo
r
=
(
IContextMenuContributor
)
handlerClass
.
getConstructor
().
newInstance
();
providerList
.
add
(
provide
r
);
contextMenuContributorList
.
add
(
contextMenuContributo
r
);
}
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
:
provide
rList
)
{
for
(
IContextMenuContributor
contributor
:
contextMenuContributo
rList
)
{
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
:
provide
rList
)
{
for
(
IContextMenuContributor
contributor
:
contextMenuContributo
rList
)
{
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
(
provide
rList
);
return
new
ContextMenuServiceIntrospectionDetailsItem
(
contextMenuContributo
rList
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment