Search in sources :

Example 1 with PreviewOutlineItemAction

use of org.eclipse.mylyn.internal.wikitext.ui.editor.actions.PreviewOutlineItemAction in project mylyn.docs by eclipse.

the class MarkupEditor method editorContextMenuAboutToShow.

@Override
protected void editorContextMenuAboutToShow(IMenuManager menu) {
    super.editorContextMenuAboutToShow(menu);
    final MarkupLanguage markupLanguage = getMarkupLanguage();
    MenuManager markupLanguageMenu = new MenuManager(Messages.MarkupEditor_markupLanguage);
    for (String markupLanguageName : new TreeSet<>(WikiText.getMarkupLanguageNames())) {
        markupLanguageMenu.add(new SetMarkupLanguageAction(this, markupLanguageName, markupLanguage != null && markupLanguageName.equals(markupLanguage.getName())));
    }
    menu.prependToGroup(ITextEditorActionConstants.GROUP_SETTINGS, markupLanguageMenu);
    OutlineItem nearestOutlineItem = getNearestMatchingOutlineItem();
    if (nearestOutlineItem != null && !nearestOutlineItem.isRootItem()) {
        menu.appendToGroup(ITextEditorActionConstants.GROUP_OPEN, new PreviewOutlineItemAction(this, nearestOutlineItem));
    }
}
Also used : SetMarkupLanguageAction(org.eclipse.mylyn.internal.wikitext.ui.editor.actions.SetMarkupLanguageAction) PreviewOutlineItemAction(org.eclipse.mylyn.internal.wikitext.ui.editor.actions.PreviewOutlineItemAction) TreeSet(java.util.TreeSet) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) AbstractMarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.AbstractMarkupLanguage) MarkupLanguage(org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage) OutlineItem(org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)

Aggregations

TreeSet (java.util.TreeSet)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 PreviewOutlineItemAction (org.eclipse.mylyn.internal.wikitext.ui.editor.actions.PreviewOutlineItemAction)1 SetMarkupLanguageAction (org.eclipse.mylyn.internal.wikitext.ui.editor.actions.SetMarkupLanguageAction)1 AbstractMarkupLanguage (org.eclipse.mylyn.wikitext.parser.markup.AbstractMarkupLanguage)1 MarkupLanguage (org.eclipse.mylyn.wikitext.parser.markup.MarkupLanguage)1 OutlineItem (org.eclipse.mylyn.wikitext.parser.outline.OutlineItem)1