Skip to content

Commit f61769f

Browse files
jnerlichvogella
authored andcommitted
Fix links and formating issues in Populating_a_dynamic_submenu.md and
Problems_View_Example.md
1 parent db4bdb4 commit f61769f

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

docs/Menu_Contributions/Populating_a_dynamic_submenu.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Menu Contributions/Populating a dynamic submenu
44
Add a dynamic submenu to the ProblemView menu
55
=============================================
66

7-
In [Menu Contributions/Problems View Example](./Menu_Contributions/Problems_View_Example.md "Menu Contributions/Problems View Example") we added 2 dynamic menus. You then have to extend the abstract [CompoundContributionItem](http://help.eclipse.org/latest/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/actions/CompoundContributionItem.html) class in your provided class.
7+
In [Menu Contributions/Problems View Example](./Problems_View_Example.md "Menu Contributions/Problems View Example") we added 2 dynamic menus.
8+
You then have to extend the abstract [CompoundContributionItem](http://help.eclipse.org/latest/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/actions/CompoundContributionItem.html) class in your provided class.
89

910
<menu id="org.eclipse.ui.views.problems.groupBy.menu"
1011
label="%ProblemView.GroupBy.label"
@@ -15,18 +16,18 @@ In [Menu Contributions/Problems View Example](./Menu_Contributions/Problems_View
1516

1617
When your menu is populated, you'll have your getContributionItems() method called:
1718

18-
protected IContributionItem\[\] getContributionItems() {
19-
IContributionItem\[\] list = new IContributionItem\[2\];
19+
protected IContributionItem[] getContributionItems() {
20+
IContributionItem[] list = new IContributionItem[2];
2021
Map parms = new HashMap();
2122
parms.put("groupBy", "Severity");
22-
list\[0\] = new CommandContributionItem(null,
23+
list[0] = new CommandContributionItem(null,
2324
"org.eclipse.ui.views.problems.grouping",
2425
parms, null, null, null, "Severity", null,
2526
null, CommandContributionItem.STYLE_PUSH);
2627
 
2728
parms = new HashMap();
2829
parms.put("groupBy", "None");
29-
list\[1\] = new CommandContributionItem(null,
30+
list[1] = new CommandContributionItem(null,
3031
"org.eclipse.ui.views.problems.grouping",
3132
parms, null, null, null, "None", null, null,
3233
CommandContributionItem.STYLE_PUSH);

docs/Menu_Contributions/Problems_View_Example.md

+18-9
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ Contents
1313
Add ProblemView menus
1414
=====================
1515

16-
Add the Problems view menus. The Problems view has one toolbar action and in the view menu, 3 actions and 2 dynamic submenus. It also has a dynamic menu and another bunch of actions in its context menu.
16+
Add the Problems view menus.
17+
The Problems view has one toolbar action and in the view menu, 3 actions and 2 dynamic submenus.
18+
It also has a dynamic menu and another bunch of actions in its context menu.
1719

1820
Commands
1921
--------
2022

21-
First define commands that are specific to the view. Since these are view commands, we can specify a default handler ... we're unlikely to replace it.
23+
First define commands that are specific to the view.
24+
Since these are view commands, we can specify a default handler ... we're unlikely to replace it.
2225

2326
<extension point="org.eclipse.ui.commands">
2427
<category id="org.eclipse.ui.views.problems"
@@ -60,7 +63,9 @@ First define commands that are specific to the view. Since these are view comman
6063
Handlers
6164
--------
6265

63-
We can also use a number of global commands, like copy, paste, delete, quick fix, and properties. For these, we just need to define our handlers. We need to add them with <activeWhen/> clauses to restrict them to being active when the view is active.
66+
We can also use a number of global commands, like copy, paste, delete, quick fix, and properties.
67+
For these, we just need to define our handlers.
68+
We need to add them with `<activeWhen/>` clauses to restrict them to being active when the view is active.
6469

6570
<extension point="org.eclipse.ui.handlers">
6671
<handler commandId="org.eclipse.ui.edit.copy"
@@ -145,16 +150,19 @@ We can also use a number of global commands, like copy, paste, delete, quick fix
145150

146151
Or we can programmatically activate them through the IHandlerService which we would retrieve from the ProblemView site.
147152

148-
IHandlerService handlerServ = (IHandlerService)getSite().getService(IHandlerService.class);
149-
CopyMarkerHandler copy = new CopyMarkerHandler();
150-
handlerServ.activateHandler("org.eclipse.ui.edit.copy", copy);
153+
IHandlerService handlerServ = (IHandlerService)getSite().getService(IHandlerService.class);
154+
CopyMarkerHandler copy = new CopyMarkerHandler();
155+
handlerServ.activateHandler("org.eclipse.ui.edit.copy", copy);
151156

152-
Using the ProblemView site to access the IHandlerService handles the <activeWhen/> clause for us, and our programmatic handler would manage its own enablement state.
157+
Using the ProblemView site to access the IHandlerService handles the `<activeWhen/>` clause for us, and our programmatic handler would manage its own enablement state.
153158

154159
Menus
155160
-----
156161

157-
Then we would define the ProblemView menu structures. We are using 3 **roots**: the view menu, the view toolbar, and the view context menu. This is an example of an "in-place" menu definition. The <menuContribution/> location attribute is a URI that defines the starting point for inserting the menu elements. The XML hierarchy mirrors the menu hierarchy, in that you can define items and menus within the body of other menus.
162+
Then we would define the ProblemView menu structures.
163+
We are using 3 **roots**: the view menu, the view toolbar, and the view context menu.
164+
This is an example of an "in-place" menu definition. The `<menuContribution/>` location attribute is a URI that defines the starting point for inserting the menu elements.
165+
The XML hierarchy mirrors the menu hierarchy, in that you can define items and menus within the body of other menus.
158166

159167
<extension point="org.eclipse.ui.menus">
160168
<menuContribution locationURI="menu:org.eclipse.ui.views.ProblemView">
@@ -349,5 +357,6 @@ The above example can be done for the view menus:
349357
menuService.addContributionFactory(viewMenuAddition);
350358
}
351359

352-
The `AbstractContributionFactory` creates new contribution items every time `createContributionItems(List)` is called. The factory location tells the framework where to insert the contributions when populating `ContributionManager`s.
360+
The `AbstractContributionFactory` creates new contribution items every time `createContributionItems(List)` is called.
361+
The factory location tells the framework where to insert the contributions when populating `ContributionManager`s.
353362

0 commit comments

Comments
 (0)