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;
}
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);
}
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);
}
}
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);
}
}
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);
}
}
Aggregations