Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kernel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
af3
kernel
Commits
64754cec
Commit
64754cec
authored
12 years ago
by
David Trachtenherz
Browse files
Options
Downloads
Patches
Plain Diff
Added possibility to start sub-menu and insert a separator at the same time
parent
6a8e5895
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/base/ContextMenuSubMenuContributorBase.java
+39
-5
39 additions, 5 deletions
.../ui/extension/base/ContextMenuSubMenuContributorBase.java
with
39 additions
and
5 deletions
org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/extension/base/ContextMenuSubMenuContributorBase.java
+
39
−
5
View file @
64754cec
...
...
@@ -54,7 +54,7 @@ import org.fortiss.tooling.kernel.ui.service.IContextMenuService;
* @author trachtenherz
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating YELLOW Hash:
6D37231B2529C38F9E563EDCFD4E39C6
* @ConQAT.Rating YELLOW Hash:
B5924C3A5FB721FD77B588B6377C35B4
*/
public
abstract
class
ContextMenuSubMenuContributorBase
<
T
extends
EObject
>
implements
IContextMenuContributor
{
...
...
@@ -105,12 +105,16 @@ public abstract class ContextMenuSubMenuContributorBase<T extends EObject> imple
int
i
=
0
;
for
(
Action
a
:
actions
)
{
if
(
hintItems
[
i
]
!=
null
&&
hintItems
[
i
].
getHint
()
==
MenuStructureHint
.
SUBMENU_START_BEFORE
)
{
(
hintItems
[
i
].
getHint
()
==
MenuStructureHint
.
SUBMENU_START_BEFORE
||
hintItems
[
i
]
.
getHint
()
==
MenuStructureHint
.
SUBMENU_START_BEFORE_SEPARATOR_BEFORE
))
{
if
(
subMenu
!=
null
)
{
// If there is a previously opened sub-menu then finish processing it because we
// use one-level sub-menus.
menu
.
add
(
subMenu
);
}
if
(
hintItems
[
i
].
getHint
()
==
MenuStructureHint
.
SUBMENU_START_BEFORE_SEPARATOR_BEFORE
)
{
menu
.
add
(
new
Separator
());
}
final
String
subMenuLabel
;
if
(
hintItems
[
i
]
instanceof
MenuStructureHintSubMenuStart
)
{
subMenuLabel
=
((
MenuStructureHintSubMenuStart
)
hintItems
[
i
]).
getSubMenuLabel
();
...
...
@@ -202,7 +206,14 @@ public abstract class ContextMenuSubMenuContributorBase<T extends EObject> imple
*/
SUBMENU_START_BEFORE
,
/** End sub-menu after current item. */
SUBMENU_END_AFTER
;
SUBMENU_END_AFTER
,
/**
* Insert separator and begin sub-menu before current.
*
* @see #SEPARATOR_BEFORE
* @see #SUBMENU_START_BEFORE
*/
SUBMENU_START_BEFORE_SEPARATOR_BEFORE
;
/** {@inheritDoc} */
@Override
...
...
@@ -231,6 +242,11 @@ public abstract class ContextMenuSubMenuContributorBase<T extends EObject> imple
/** @see #getSubMenuLabel() */
private
String
subMenuLabel
;
/**
* @see #getHint()
*/
private
MenuStructureHint
menuStructureHint
;
/**
* Creates a {@link MenuStructureHintSubMenuStart} with default sub-menu label text.
*
...
...
@@ -244,7 +260,22 @@ public abstract class ContextMenuSubMenuContributorBase<T extends EObject> imple
* Creates a {@link MenuStructureHintSubMenuStart} with given sub-menu label text.
*/
public
MenuStructureHintSubMenuStart
(
String
subMenuLabel
)
{
this
(
subMenuLabel
,
false
);
}
/**
* Creates a {@link MenuStructureHintSubMenuStart} with given sub-menu label text.
* If {@code separatorBefore} is true than {@link #getHint()} will later return
* {@link MenuStructureHint#SUBMENU_START_BEFORE_SEPARATOR_BEFORE} otherwise
* {@link MenuStructureHint#SUBMENU_START_BEFORE}.
*/
public
MenuStructureHintSubMenuStart
(
String
subMenuLabel
,
boolean
separatorBefore
)
{
this
.
subMenuLabel
=
subMenuLabel
;
if
(
separatorBefore
)
{
menuStructureHint
=
MenuStructureHint
.
SUBMENU_START_BEFORE_SEPARATOR_BEFORE
;
}
else
{
menuStructureHint
=
MenuStructureHint
.
SUBMENU_START_BEFORE
;
}
}
/** Returns the sub-menu label text. */
...
...
@@ -255,11 +286,14 @@ public abstract class ContextMenuSubMenuContributorBase<T extends EObject> imple
/**
* {@inheritDoc}
*
* @return MenuStructureHint.SUBMENU_START_BEFORE
* @return {@link MenuStructureHint#SUBMENU_START_BEFORE} or
* {@link MenuStructureHint#SUBMENU_START_BEFORE_SEPARATOR_BEFORE}, depending on the
* initialization parameters used for the constructor (see
* {@link #MenuStructureHintSubMenuStart(String, boolean)}.
*/
@Override
public
MenuStructureHint
getHint
()
{
return
M
enuStructureHint
.
SUBMENU_START_BEFORE
;
return
this
.
m
enuStructureHint
;
}
/** {@inheritDoc} */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment