Example usage for org.eclipse.jface.resource JFaceResources TEXT_FONT

List of usage examples for org.eclipse.jface.resource JFaceResources TEXT_FONT

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources TEXT_FONT.

Prototype

String TEXT_FONT

To view the source code for org.eclipse.jface.resource JFaceResources TEXT_FONT.

Click Source Link

Document

The symbolic font name for the text font (value "org.eclipse.jface.textfont").

Usage

From source file:com.halware.nakedide.eclipse.core.templates.propl.TemplPropl.java

License:Open Source License

private IInformationControlCreator defaultCreatorWithHtmlTextPresenter() {
    return new IInformationControlCreator() {
        public IInformationControl createInformationControl(Shell parent) {
            BrowserInformationControl browserInformationControl = new BrowserInformationControl(parent,
                    JFaceResources.TEXT_FONT /*(SWT.TOOL | SWT.NO_TRIM), SWT.COLOR_GREEN*/,
                    getTemplate().getName());
            return browserInformationControl;
        }/* w  w w .  jav a2 s.  c  o  m*/
    };
}

From source file:com.iw.plugins.spindle.editors.SummarySourceViewer.java

License:Mozilla Public License

private void initializeWidgetFont(StyledText styledText) {
    IPreferenceStore store = getPreferenceStore();
    if (store != null) {

        FontData data = null;/*  w  ww . j  a  v  a2  s.c o  m*/

        if (store.contains(JFaceResources.TEXT_FONT) && !store.isDefault(JFaceResources.TEXT_FONT)) {
            data = PreferenceConverter.getFontData(store, JFaceResources.TEXT_FONT);
        } else {
            data = PreferenceConverter.getDefaultFontData(store, JFaceResources.TEXT_FONT);
        }

        if (data != null) {
            Font font = new Font(styledText.getDisplay(), data);
            styledText.setFont(font);

            if (currentFont != null)
                currentFont.dispose();

            currentFont = font;
            return;
        }
    }

    // if all the preferences failed
    styledText.setFont(JFaceResources.getTextFont());
}

From source file:com.iw.plugins.spindle.ui.preferences.SpindleFormatterPreferencePage.java

License:Mozilla Public License

private Control createPreviewer(Composite parent) {
    fPreviewViewer = new SourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);

    fSpecConfiguration = new BasicSpecConfiguration(UIPlugin.getDefault().getXMLTextTools(), null,
            getOverlayStore()) {// w w  w .  j  a v a 2s .  c o m

        public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
            return null;
        }

        public IReconciler getReconciler(ISourceViewer sourceViewer) {
            return null;
        }

        public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
            return null;
        }

        public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer) {
            return null;
        }

        public IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer sourceViewer, String contentType) {
            return null;
        }

        public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) {
            return new String[] { "\t", "    ", "" };
        }

        public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
            return null;
        }

        public IHyperlinkPresenter getHyperlinkPresenter(ISourceViewer sourceViewer) {
            return null;
        }

        public int getHyperlinkStateMask(ISourceViewer sourceViewer) {
            return -1;
        }

    };

    fPreviewViewer.configure(fSpecConfiguration);
    fPreviewViewer.setEditable(false);
    Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT);
    fPreviewViewer.getTextWidget().setFont(font);
    fMarginPainter = installMarginPainter(fPreviewViewer);

    fPreviewerUpdater = new PreviewerUpdater(fPreviewViewer, getOverlayStore());

    fContent = loadPreviewContentFromFile("FormatPreview.txt");

    fDocument = new Document(fContent);
    XMLReconciler model = new SpecDocumentSetupParticipant().setup(fDocument);
    BaseDocumentSetupParticipant.removeModel(fDocument);
    fPreviewViewer.setDocument(fDocument);
    format(getOverlayStore());
    return fPreviewViewer.getControl();
}

From source file:com.javadude.antxr.eclipse.ui.editor.AntxrOverview.java

License:Open Source License

/**
 * Create an instance of AntxrOverview.//from ww  w.  j a  v  a 2s  .c  o m
 * @param aParent
 */
public AntxrOverview(Composite aParent) {
    super(aParent, null, SWT.V_SCROLL | SWT.H_SCROLL);

    EditorEnvironment.connect();

    // Configure source viewer
    configure(new AntxrConfiguration(null));
    getTextWidget().setEditable(false);
    getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT));
    // Create document with attached partitioner
    IDocument document = new Document();
    IDocumentPartitioner partitioner = new FastPartitioner(new PartitionScanner(),
            PartitionScanner.PARTITION_TYPES);
    partitioner.connect(document);
    document.setDocumentPartitioner(partitioner);

    // Attach document to source viewer AFTER configuring source viewer
    // Otherwise syntax highlighting will not work
    setDocument(document);
}

From source file:com.microsoft.tfs.client.common.ui.framework.helper.UIHelpers.java

License:Open Source License

public static Font getTextFont(final Device device) {
    final FontData[] fontDatas = JFaceResources.getFontRegistry().getFontData(JFaceResources.TEXT_FONT);
    return new Font(device, fontDatas);
}

From source file:com.redhat.ceylon.eclipse.code.editor.CeylonEditor.java

License:Open Source License

private void setSourceFontFromPreference() {
    String fontName = WorkbenchPlugin.getDefault().getPreferenceStore().getString(JFaceResources.TEXT_FONT);
    FontRegistry fontRegistry = CeylonPlugin.getInstance().getFontRegistry();
    if (!fontRegistry.hasValueFor(fontName)) {
        fontRegistry.put(fontName, PreferenceConverter.readFontData(fontName));
    }//w w  w . j ava2 s  .  c o  m
    Font sourceFont = fontRegistry.get(fontName);
    if (sourceFont != null) {
        getSourceViewer().getTextWidget().setFont(sourceFont);
    }
}

From source file:com.salesforce.ide.ui.editors.apex.preferences.ApexTemplatePreferencePage.java

License:Open Source License

@Override
protected SourceViewer createViewer(Composite parent) {
    final SourceViewer viewer = super.createViewer(parent);

    new ApexDocumentSetupParticipant().setup(viewer.getDocument());

    final ApexSourceViewerConfiguration configuration = new ApexSourceViewerConfiguration(preferenceStore(),
            null);/*from w w  w .  ja  va  2s . com*/
    configuration.init(null);
    viewer.unconfigure();
    viewer.configure(configuration);

    viewer.getTextWidget().setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
    viewer.setEditable(false);

    return viewer;
}

From source file:com.salesforce.ide.ui.wizards.components.apex.ApexCodeTemplateSelectionPage.java

License:Open Source License

/**
 * Creates, configures and returns a source viewer to present the template
 * pattern on the preference page. Clients may override to provide a
 * custom source viewer featuring e.g. syntax coloring.
 * //ww w  .j  a v  a2  s.  c  om
 * @param parent
 *            the parent control
 * @return a configured source viewer
 */
@Override
protected final SourceViewer createViewer(Composite parent) {
    final ApexSourceViewerConfiguration configuration = new ApexSourceViewerConfiguration(preferenceStore(),
            null);
    configuration.init(this.componentModel.getProject());

    final IDocument document = new Document();
    new ApexDocumentSetupParticipant().setup(document);

    SourceViewer viewer = new SourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    viewer.configure(configuration);
    viewer.setDocument(document);

    viewer.getTextWidget().setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
    viewer.setEditable(false);

    return viewer;
}

From source file:com.sap.dirigible.ide.terminal.ui.TerminalView.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    GridLayout layout = new GridLayout(1, false);

    parent.setLayout(layout);// ww w  .  ja v a 2  s. c  o  m
    parent.setBackground(new Color(null, 0, 0, 0));
    parent.setForeground(new Color(null, 0, 255, 0));

    Font terminalFont = JFaceResources.getFont(JFaceResources.TEXT_FONT);

    commandHistory = new Text(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
    commandHistory.setLayoutData(new GridData(GridData.FILL_BOTH));
    commandHistory.setBackground(new Color(null, 0, 0, 0));
    commandHistory.setForeground(new Color(null, 0, 255, 0));
    commandHistory.setFont(terminalFont);

    commandLine = new Text(parent, SWT.BORDER);
    commandLine.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    commandLine.setBackground(new Color(null, 0, 0, 0));
    commandLine.setForeground(new Color(null, 0, 255, 0));
    commandLine.setFont(terminalFont);
    commandLine.addKeyListener(new KeyListener() {

        @Override
        public void keyReleased(KeyEvent e) {
            //
        }

        @Override
        public void keyPressed(KeyEvent e) {
            if (e.keyCode == SWT.CR) {
                //MessageDialog.openInformation(null, "Info", commandLine.getText());

                try {
                    String result = executeCommand(ProcessUtils.translateCommandline(commandLine.getText()));
                    commandHistory.setText(result);
                } catch (IOException ex) {
                    commandHistory.setText(ex.getMessage());
                }
            }

        }
    });

}

From source file:com.siteview.mde.internal.ui.preferences.SyntaxColorTab.java

License:Open Source License

private void createPreviewer(Composite parent) {
    Composite previewComp = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = layout.marginWidth = 0;
    previewComp.setLayout(layout);//from  ww w .j av  a 2  s . c  o  m
    previewComp.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label label = new Label(previewComp, SWT.NONE);
    label.setText(MDEUIMessages.SyntaxColorTab_preview);
    label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fPreviewViewer = new SourceViewer(previewComp, null, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    fSourceViewerConfiguration = getSourceViewerConfiguration();

    if (fSourceViewerConfiguration != null)
        fPreviewViewer.configure(fSourceViewerConfiguration);

    fPreviewViewer.setEditable(false);
    fPreviewViewer.getTextWidget().setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
    fPreviewViewer.setDocument(getDocument());

    Control control = fPreviewViewer.getControl();
    control.setLayoutData(new GridData(GridData.FILL_BOTH));
}