use of org.eclipse.mylyn.wikitext.parser.outline.OutlineItem in project mylyn.docs by eclipse.
the class XslfoDocumentBuilderIntegrationTest method testforTableRowAlign_bug336813.
public void testforTableRowAlign_bug336813() {
final String markup = "{|\n" + "|- valign=\"top\"\n |'''Row heading'''\n" + "| A longer piece of text. Lorem ipsum...\n |A shorter piece of text.\n" + "|- style=\"vertical-align: bottom;\"\n |'''Row heading'''\n" + "|A longer piece of text. Lorem ipsum... \n |A shorter piece of text.\n" + "|}";
documentBuilder.getConfiguration().setPageNumbering(true);
documentBuilder.getConfiguration().setTitle("Title");
OutlineItem op = new OutlineParser(new MediaWikiLanguage()).parse(markup);
documentBuilder.setOutline(op);
parser.setMarkupLanguage(new MediaWikiLanguage());
parser.parse(markup, true);
final String xslfo = out.toString();
// From "valign" attribute
assertTrue(Pattern.compile("<table-row display-align=\"before\">").matcher(xslfo).find());
// From css styling
assertTrue(Pattern.compile("<table-row display-align=\"after\">").matcher(xslfo).find());
}
use of org.eclipse.mylyn.wikitext.parser.outline.OutlineItem in project mylyn.docs by eclipse.
the class MarkupEditor method updateOutlineNow.
private void updateOutlineNow() {
if (!outlineDirty) {
return;
}
if (!isSourceViewerValid()) {
return;
}
// we maintain the outline even if the outline page is not in use, which allows us to use the outline for
// content assist and other things
MarkupLanguage markupLanguage = getMarkupLanguage();
if (markupLanguage == null) {
return;
}
final MarkupLanguage language = markupLanguage.clone();
final String content = document.get();
final int contentGeneration;
synchronized (MarkupEditor.this) {
contentGeneration = documentGeneration;
}
outlineParser.setMarkupLanguage(language);
OutlineItem rootItem = outlineParser.parse(content);
updateOutline(contentGeneration, rootItem);
}
use of org.eclipse.mylyn.wikitext.parser.outline.OutlineItem in project mylyn.docs by eclipse.
the class MarkupEditor method show.
public boolean show(ShowInContext context) {
ISelection selection = context.getSelection();
if (selection instanceof IStructuredSelection) {
for (Object element : ((IStructuredSelection) selection).toArray()) {
if (element instanceof OutlineItem) {
OutlineItem item = (OutlineItem) element;
selectAndReveal(item);
if (isOutlinePageValid()) {
outlinePage.setSelection(selection);
}
return true;
}
}
} else if (selection instanceof ITextSelection) {
ITextSelection textSel = (ITextSelection) selection;
selectAndReveal(textSel.getOffset(), textSel.getLength());
return true;
}
return false;
}
use of org.eclipse.mylyn.wikitext.parser.outline.OutlineItem 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));
}
}
use of org.eclipse.mylyn.wikitext.parser.outline.OutlineItem in project mylyn.docs by eclipse.
the class OutlineItemAdapterFactoryTest method testAdaptsToIWorkbenchAdapter.
public void testAdaptsToIWorkbenchAdapter() {
Object adapter = Platform.getAdapterManager().getAdapter(new OutlineItem(null, 0, "id", 0, 10, "ID"), IWorkbenchAdapter.class);
assertNotNull(adapter);
assertTrue(IWorkbenchAdapter.class.isAssignableFrom(adapter.getClass()));
}
Aggregations