Search in sources :

Example 91 with FontData

use of org.eclipse.swt.graphics.FontData in project tdi-studio-se by Talend.

the class TraceDebugProcessComposite method setConsoleFont.

private boolean setConsoleFont() {
    IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
    String fontType = preferenceStore.getString(RunProcessPrefsConstants.CONSOLE_FONT);
    if (StringUtils.isNotEmpty(fontType)) {
        FontData fontData = new FontData(fontType);
        if (consoleText.getFont() != null) {
            FontData oldFont = consoleText.getFont().getFontData()[0];
            // font is same
            if (oldFont.equals(fontData)) {
                return false;
            }
        }
        Font font = new Font(this.getDisplay(), fontData);
        consoleText.setFont(font);
        return true;
    }
    return false;
}
Also used : FontData(org.eclipse.swt.graphics.FontData) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) Font(org.eclipse.swt.graphics.Font)

Example 92 with FontData

use of org.eclipse.swt.graphics.FontData in project tdi-studio-se by Talend.

the class SQLTextViewer method adaptToPreferenceChange.

void adaptToPreferenceChange(PropertyChangeEvent event) {
    if (event.getProperty().equals(IConstants.FONT)) {
        FontData[] fData = PreferenceConverter.getFontDataArray(store, IConstants.FONT);
        String des = store.getString(IConstants.FONT);
        JFaceResources.getFontRegistry().put(des, fData);
        Control ctrl = this.getControl();
        if (ctrl != null) {
            ctrl.setFont(JFaceResources.getFontRegistry().get(des));
        }
    }
}
Also used : DefaultInformationControl(org.eclipse.jface.text.DefaultInformationControl) IInformationControl(org.eclipse.jface.text.IInformationControl) Control(org.eclipse.swt.widgets.Control) FontData(org.eclipse.swt.graphics.FontData)

Example 93 with FontData

use of org.eclipse.swt.graphics.FontData in project tdi-studio-se by Talend.

the class DatabaseBusinessItemNameEditPart method refreshFont.

/**
     * @generated
     */
protected void refreshFont() {
    FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
    if (style != null) {
        FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
        setFont(fontData);
    }
}
Also used : FontStyle(org.eclipse.gmf.runtime.notation.FontStyle) FontData(org.eclipse.swt.graphics.FontData)

Example 94 with FontData

use of org.eclipse.swt.graphics.FontData in project tdi-studio-se by Talend.

the class BusinessItemRelationshipNameEditPart method refreshFont.

/**
     * @generated
     */
protected void refreshFont() {
    FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
    if (style != null) {
        FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
        setFont(fontData);
    }
}
Also used : FontStyle(org.eclipse.gmf.runtime.notation.FontStyle) FontData(org.eclipse.swt.graphics.FontData)

Example 95 with FontData

use of org.eclipse.swt.graphics.FontData in project tdi-studio-se by Talend.

the class NodeLabelEditManager method initCellEditor.

@Override
protected void initCellEditor() {
    Connection connection = ((ConnectionLabel) this.getEditPart().getModel()).getConnection();
    if (getCellEditor() instanceof NodeLabelCellEditor) {
        ((NodeLabelCellEditor) getCellEditor()).setCurrentConnection(connection);
    }
    Label label = (Label) (getEditPart()).getFigure();
    String initialLabelText = label.getText();
    getCellEditor().setValue(initialLabelText);
    text = (Text) getCellEditor().getControl();
    IFigure figure = (getEditPart()).getFigure();
    scaledFont = figure.getFont();
    FontData data = scaledFont.getFontData()[0];
    Dimension fontSize = new Dimension(0, data.getHeight());
    label.translateToAbsolute(fontSize);
    data.setHeight(fontSize.height);
    scaledFont = new Font(null, data);
    text.setFont(scaledFont);
    text.selectAll();
}
Also used : FontData(org.eclipse.swt.graphics.FontData) Label(org.eclipse.draw2d.Label) Dimension(org.eclipse.draw2d.geometry.Dimension) Font(org.eclipse.swt.graphics.Font) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

FontData (org.eclipse.swt.graphics.FontData)147 Font (org.eclipse.swt.graphics.Font)89 GridData (org.eclipse.swt.layout.GridData)30 Label (org.eclipse.swt.widgets.Label)26 GridLayout (org.eclipse.swt.layout.GridLayout)25 Composite (org.eclipse.swt.widgets.Composite)25 Point (org.eclipse.swt.graphics.Point)23 Test (org.junit.Test)21 Color (org.eclipse.swt.graphics.Color)15 FontStyle (org.eclipse.gmf.runtime.notation.FontStyle)14 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)11 Button (org.eclipse.swt.widgets.Button)10 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)9 Display (org.eclipse.swt.widgets.Display)9 Text (org.eclipse.swt.widgets.Text)9 GC (org.eclipse.swt.graphics.GC)8 StyleRange (org.eclipse.swt.custom.StyleRange)7 Image (org.eclipse.swt.graphics.Image)7 IOException (java.io.IOException)6