Search in sources :

Example 1 with CssStyleManager

use of org.eclipse.mylyn.internal.wikitext.ui.viewer.CssStyleManager in project mylyn.docs by eclipse.

the class EditorPreferencePage method createFieldEditors.

/**
 * Creates the field editors. Field editors are abstractions of the common GUI blocks needed to manipulate various
 * types of preferences. Each field editor knows how to save and restore itself.
 */
@Override
public void createFieldEditors() {
    Preferences prefs = new Preferences();
    Layout fieldEditorParentLayout = getFieldEditorParent().getLayout();
    if (fieldEditorParentLayout instanceof GridLayout) {
        GridLayout layout = (GridLayout) fieldEditorParentLayout;
        layout.marginRight = 5;
    }
    Group blockGroup = new Group(getFieldEditorParent(), SWT.NULL);
    blockGroup.setText(Messages.EditorPreferencePage_blockModifiers);
    blockGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());
    CssStyleManager cssStyleManager = new CssStyleManager(getFont());
    for (Map.Entry<String, String> ent : prefs.getCssByBlockModifierType().entrySet()) {
        String preferenceKey = Preferences.toPreferenceKey(ent.getKey(), true);
        addField(new CssStyleFieldEditor(cssStyleManager, preferenceKey, ent.getKey(), blockGroup));
    }
    // bug 260427
    Layout layout = blockGroup.getLayout();
    if (layout instanceof GridLayout) {
        GridLayout gridLayout = (GridLayout) layout;
        gridLayout.marginWidth = 5;
        gridLayout.marginHeight = 5;
    }
    Group phraseModifierGroup = new Group(getFieldEditorParent(), SWT.NULL);
    phraseModifierGroup.setText(Messages.EditorPreferencePage_phraseModifiers);
    phraseModifierGroup.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());
    for (Map.Entry<String, String> ent : prefs.getCssByPhraseModifierType().entrySet()) {
        String preferenceKey = Preferences.toPreferenceKey(ent.getKey(), false);
        addField(new CssStyleFieldEditor(cssStyleManager, preferenceKey, ent.getKey(), phraseModifierGroup));
    }
    // bug 260427
    layout = phraseModifierGroup.getLayout();
    if (layout instanceof GridLayout) {
        GridLayout gridLayout = (GridLayout) layout;
        gridLayout.marginWidth = 5;
        gridLayout.marginHeight = 5;
    }
    applyDialogFont(getFieldEditorParent());
    blockGroup.setFont(getFieldEditorParent().getFont());
    phraseModifierGroup.setFont(getFieldEditorParent().getFont());
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), // $NON-NLS-1$
    "org.eclipse.mylyn.wikitext.help.ui.preferences");
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Layout(org.eclipse.swt.widgets.Layout) GridLayout(org.eclipse.swt.layout.GridLayout) Map(java.util.Map) CssStyleManager(org.eclipse.mylyn.internal.wikitext.ui.viewer.CssStyleManager)

Example 2 with CssStyleManager

use of org.eclipse.mylyn.internal.wikitext.ui.viewer.CssStyleManager in project mylyn.docs by eclipse.

the class MarkupTokenScanner method initialize.

private void initialize(Font defaultFont, Font defaultMonospaceFont) {
    styleManager = new CssStyleManager(defaultFont, defaultMonospaceFont);
    defaultState = styleManager.createDefaultFontState();
}
Also used : CssStyleManager(org.eclipse.mylyn.internal.wikitext.ui.viewer.CssStyleManager)

Aggregations

CssStyleManager (org.eclipse.mylyn.internal.wikitext.ui.viewer.CssStyleManager)2 Map (java.util.Map)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Group (org.eclipse.swt.widgets.Group)1 Layout (org.eclipse.swt.widgets.Layout)1