Search in sources :

Example 11 with FontData

use of org.eclipse.swt.graphics.FontData in project translationstudio8 by heartsome.

the class ConcordanceSearchDialog method createResultsStyle.

private TextStyle createResultsStyle() {
    background = new Color(Display.getCurrent(), 0x19, 0x19, 0x70);
    foreground = new Color(Display.getCurrent(), 0xff, 0xff, 0xff);
    FontData fontData = JFaceResources.getDefaultFont().getFontData()[0];
    fontData.setStyle(fontData.getStyle());
    rsFont = new Font(Display.getDefault(), fontData);
    TextStyle style = new TextStyle(rsFont, foreground, background);
    return style;
}
Also used : TextStyle(org.eclipse.swt.graphics.TextStyle) Color(org.eclipse.swt.graphics.Color) FontData(org.eclipse.swt.graphics.FontData) Font(org.eclipse.swt.graphics.Font)

Example 12 with FontData

use of org.eclipse.swt.graphics.FontData in project translationstudio8 by heartsome.

the class SystemPreferenceInitializer method initializeDefaultPreferences.

@Override
public void initializeDefaultPreferences() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    store.setDefault(IPreferenceConstants.SYSTEM_AUTO_UPDATE, IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY);
    store.setDefault(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE, 2);
    store.setDefault(IPreferenceConstants.SYSTEM_LANGUAGE, IPreferenceConstants.SYSTEM_LANGUAGE_WITH_EN);
    // 默认语言从产品的 ini 文件中取值
    Location configArea = Platform.getInstallLocation();
    String locale = "en";
    URL location = null;
    try {
        location = new URL(configArea.getURL().toExternalForm() + "configuration" + File.separator + "config.ini");
    } catch (MalformedURLException e) {
        // This should never happen
        LOGGER.error(Messages.getString("preferencepage.SystemPreferenceInitializer.logger1"), e);
    }
    try {
        String fileName = location.getFile();
        BufferedReader in = new BufferedReader(new FileReader(fileName));
        boolean isNl = false;
        String line = in.readLine();
        while (line != null) {
            if (line.startsWith("osgi.nl=")) {
                isNl = true;
                locale = line.substring("osgi.nl=".length()).trim();
                break;
            }
            line = in.readLine();
        }
        in.close();
        if (!isNl) {
            locale = "en";
        }
    } catch (FileNotFoundException e) {
        LOGGER.error(Messages.getString("preferencepage.SystemPreferenceInitializer.logger1"), e);
    } catch (IOException e) {
        LOGGER.error("", e);
    }
    if (locale != null) {
        if (locale.startsWith("en")) {
            CommonFunction.setSystemLanguage("en");
            store.setValue(IPreferenceConstants.SYSTEM_LANGUAGE, IPreferenceConstants.SYSTEM_LANGUAGE_WITH_EN);
        } else if (locale.startsWith("zh")) {
            CommonFunction.setSystemLanguage("zh");
            store.setValue(IPreferenceConstants.SYSTEM_LANGUAGE, IPreferenceConstants.SYSTEM_LANGUAGE_WITH_ZH_CN);
        }
    }
    store.setDefault(IPreferenceConstants.SYSTEM_USER, System.getProperty("user.name"));
    //将用户保存到平台首选项中
    PlatformUI.getPreferenceStore().setDefault(IPreferenceConstants.SYSTEM_USER, store.getDefaultString(IPreferenceConstants.SYSTEM_USER));
    FontData fd = JFaceResources.getDefaultFont().getFontData()[0];
    store.setDefault(IPreferenceConstants.XLIFF_EDITOR_FONT_NAME, fd.getName());
    int fontSize = fd.getHeight();
    store.setDefault(IPreferenceConstants.XLIFF_EDITOR_FONT_SIZE, fontSize < 13 ? 13 : fontSize);
    store.setDefault(IPreferenceConstants.MATCH_VIEW_FONT_NAME, fd.getName());
    store.setDefault(IPreferenceConstants.MATCH_VIEW_FONT_SIZE, fontSize < 13 ? 13 : fontSize);
    store.setDefault(IPreferenceConstants.XLIFF_EDITOR_SHOWHIDEN_NONPRINTCHARACTER, false);
}
Also used : MalformedURLException(java.net.MalformedURLException) FontData(org.eclipse.swt.graphics.FontData) BufferedReader(java.io.BufferedReader) FileNotFoundException(java.io.FileNotFoundException) FileReader(java.io.FileReader) IOException(java.io.IOException) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) URL(java.net.URL) Location(org.eclipse.osgi.service.datalocation.Location)

Example 13 with FontData

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

the class BidirectionalBusinessItemRelationshipNameEditPart 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 14 with FontData

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

the class DecisionBusinessItemNameEditPart 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 15 with FontData

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

the class ActorBusinessItemNameEditPart 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)

Aggregations

FontData (org.eclipse.swt.graphics.FontData)70 Font (org.eclipse.swt.graphics.Font)38 FontStyle (org.eclipse.gmf.runtime.notation.FontStyle)14 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)11 GridData (org.eclipse.swt.layout.GridData)11 GridLayout (org.eclipse.swt.layout.GridLayout)9 Composite (org.eclipse.swt.widgets.Composite)9 Point (org.eclipse.swt.graphics.Point)8 Label (org.eclipse.swt.widgets.Label)8 Text (org.eclipse.swt.widgets.Text)5 ColorStyledText (org.talend.commons.ui.swt.colorstyledtext.ColorStyledText)5 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 Color (org.eclipse.swt.graphics.Color)4 GC (org.eclipse.swt.graphics.GC)4 IFigure (org.eclipse.draw2d.IFigure)3 Dimension (org.eclipse.draw2d.geometry.Dimension)3 DecoratedField (org.eclipse.jface.fieldassist.DecoratedField)3 FormAttachment (org.eclipse.swt.layout.FormAttachment)3 FormData (org.eclipse.swt.layout.FormData)3