Skip to content

Commit

Permalink
extracted constants
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed Nov 17, 2023
1 parent 5c2ba1d commit 8c24dee
Showing 1 changed file with 13 additions and 9 deletions.
Expand Up @@ -63,6 +63,10 @@ public class WorkbenchActionBarContributor extends
MultiPageEditorActionBarContributor implements IMenuListener,
IPropertyListener, ISelectionChangedListener {

private static final String ADDITIONS_END = "additions-end";

private static final String ADDITIONS = "additions";

@Inject
private EditingActionManager editingActionManager;

Expand Down Expand Up @@ -119,11 +123,11 @@ public void contributeToMenu(IMenuManager menuManager) {
IMenuManager submenuManager = new MenuManager("EMF Parsley",
"org.eclipse.emf.parsley.MenuID");

menuManager.insertAfter("additions", submenuManager);
menuManager.insertAfter(ADDITIONS, submenuManager);
submenuManager.add(new Separator("settings"));
submenuManager.add(new Separator("actions"));
submenuManager.add(new Separator("additions"));
submenuManager.add(new Separator("additions-end"));
submenuManager.add(new Separator(ADDITIONS));
submenuManager.add(new Separator(ADDITIONS_END));

// (*)

Expand Down Expand Up @@ -257,18 +261,18 @@ public void update() {
@Override
public void menuAboutToShow(IMenuManager menuManager) {
if ((style & ADDITIONS_LAST_STYLE) == 0) {
menuManager.add(new Separator("additions"));
menuManager.add(new Separator(ADDITIONS));
}
menuManager.add(new Separator("edit"));

ensureActionsAreInitialized();
editingActionManager.menuAboutToShow(menuManager);

if ((style & ADDITIONS_LAST_STYLE) != 0) {
menuManager.add(new Separator("additions"));
menuManager.add(new Separator(ADDITIONS));
menuManager.add(new Separator());
}
menuManager.add(new Separator("additions-end"));
menuManager.add(new Separator(ADDITIONS_END));

addGlobalActions(menuManager);

Expand All @@ -284,10 +288,10 @@ protected void ensureActionsAreInitialized() {
}

protected void addGlobalActions(IMenuManager menuManager) {
menuManager.insertAfter("additions-end", new Separator("ui-actions"));
menuManager.insertAfter(ADDITIONS_END, new Separator("ui-actions"));

String key = (style & ADDITIONS_LAST_STYLE) == 0 ? "additions-end"
: "additions";
String key = (style & ADDITIONS_LAST_STYLE) == 0 ? ADDITIONS_END
: ADDITIONS;
if (validateAction != null) {
menuManager.insertBefore(key, new ActionContributionItem(
validateAction));
Expand Down

0 comments on commit 8c24dee

Please sign in to comment.