本文整理匯總了Java中org.eclipse.jface.preference.PreferenceConverter.getFontDataArray方法的典型用法代碼示例。如果您正苦於以下問題:Java PreferenceConverter.getFontDataArray方法的具體用法?Java PreferenceConverter.getFontDataArray怎麽用?Java PreferenceConverter.getFontDataArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.preference.PreferenceConverter
的用法示例。
在下文中一共展示了PreferenceConverter.getFontDataArray方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: LogFileViewer
import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
public LogFileViewer(Composite parent, int style) {
store = LogViewerPlugin.getDefault().getPreferenceStore();
if (store.getBoolean(ILogViewerConstants.PREF_WORD_WRAP))
style |= SWT.WRAP;
showWhenUpdated = store.getBoolean(ILogViewerConstants.PREF_SHOW_WHEN_UPDATED);
showTopOfFile = store.getBoolean(ILogViewerConstants.PREF_SHOW_TOP_OF_FILE);
txtViewer = new SourceViewer(parent,null,style);
FontData[] fontData = PreferenceConverter.getFontDataArray(store,ILogViewerConstants.PREF_EDITOR_FONT_STYLE);
if(fontData == null) {
fontData = JFaceResources.getDefaultFont().getFontData();
}
txtViewer.getTextWidget().setFont(new Font(Display.getCurrent(),fontData));
propertyChangeListener = new PropertyChangeListener();
store.addPropertyChangeListener(propertyChangeListener);
createCursorLinePainter();
createAndInstallPresentationReconciler();
}
示例2: propertyChange
import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
public void propertyChange(PropertyChangeEvent event) {
if(event.getProperty().equals(ILogViewerConstants.PREF_CURSORLINE_COLOR)) {
Color color = new Color(Display.getCurrent(),PreferenceConverter.getColor(store,ILogViewerConstants.PREF_CURSORLINE_COLOR));
cursorLinePainter.setHighlightColor(color);
}
if(event.getProperty().equals(ILogViewerConstants.PREF_EDITOR_FONT_STYLE)) {
FontData[] fontData = PreferenceConverter.getFontDataArray(store,ILogViewerConstants.PREF_EDITOR_FONT_STYLE);
txtViewer.getTextWidget().setFont(new Font(Display.getCurrent(),fontData));
}
if(event.getProperty().equals(ILogViewerConstants.PREF_WORD_WRAP)) {
boolean wordWrap = store.getBoolean(ILogViewerConstants.PREF_WORD_WRAP);
txtViewer.getTextWidget().setWordWrap(wordWrap);
}
if(event.getProperty().equals(ILogViewerConstants.PREF_SHOW_WHEN_UPDATED)) {
showWhenUpdated = store.getBoolean(ILogViewerConstants.PREF_SHOW_WHEN_UPDATED);
}
if(event.getProperty().equals(ILogViewerConstants.PREF_SHOW_TOP_OF_FILE)) {
showTopOfFile = store.getBoolean(ILogViewerConstants.PREF_SHOW_TOP_OF_FILE);
}
}
示例3: zoomFont
import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
protected FontData[] zoomFont(String key, double zoomFactor) {
FontData[] fontData = PreferenceConverter.getFontDataArray(this, key);
// Convert font to zoom factor.
for (int i = 0; i < fontData.length; i++) {
fontData[i].setHeight((int) (fontData[i].getHeight() * zoomFactor));
}
return fontData;
}
示例4: getFont
import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
public Font getFont(String key, boolean isAdjustingForZoomFactor) {
try {
String adjustedKey = key;
if (isAdjustingForZoomFactor) {
double zoomFactor = getDouble(APP_ZOOM_FACTOR);
adjustedKey = getZoomFontKey(key, zoomFactor);
}
if (!Raptor.getInstance().getFontRegistry()
.hasValueFor(adjustedKey)) {
FontData[] fontData = null;
if (!isAdjustingForZoomFactor) {
fontData = PreferenceConverter.getFontDataArray(this, key);
} else {
fontData = zoomFont(key, getDouble(APP_ZOOM_FACTOR));
}
Raptor.getInstance().getFontRegistry()
.put(adjustedKey, fontData);
}
return Raptor.getInstance().getFontRegistry().get(adjustedKey);
} catch (Throwable t) {
LOG.error("Error in getFont(" + key + ") Returning default font.",
t);
return Raptor.getInstance().getFontRegistry().defaultFont();
}
}
示例5: setupSegmenterValueFont
import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
private void setupSegmenterValueFont() {
if (_segmenterValueFont != null) {
_segmenterValueFont.dispose();
}
final FontData[] valueFontData = PreferenceConverter.getFontDataArray(//
_prefStore,
ITourbookPreferences.TOUR_SEGMENTER_CHART_VALUE_FONT);
_segmenterValueFont = new Font(getDisplay(), valueFontData);
}
示例6: populateTextStyle
import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
public void populateTextStyle(String id, TextStyle style, TextStyle defaults) {
// prepare
String colorKey = PREFERENCE_TAG + PreferenceStoreAccessor.getTokenColorPreferenceKey(id);
String backgroundKey = PREFERENCE_TAG + getTokenBackgroundColorPreferenceKey(id);
String fontKey = PREFERENCE_TAG + getTokenFontPreferenceKey(id);
String styleKey = PREFERENCE_TAG + getTokenStylePreferenceKey(id);
// DefaultDefault
IPreferenceStore editorsStore = EditorsUI.getPreferenceStore();
RGB fontColorDefaultDefault = editorsStore.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT) ? getDisplay()
.getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB()
: PreferenceConverter.getColor(editorsStore, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND);
RGB backgrounColorDefaultDefault = editorsStore
.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT) ? getDisplay().getSystemColor(
SWT.COLOR_LIST_BACKGROUND).getRGB() : PreferenceConverter.getColor(editorsStore,
AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
FontData[] fontDataDefaultDefault = JFaceResources.getTextFont().getFontData();
// set defaults
IPreferenceStore preferenceStore = getPreferenceStore();
if (defaults.getColor() != null)
PreferenceConverter.setDefault(preferenceStore, colorKey, defaults.getColor());
else {
PreferenceConverter.setDefault(preferenceStore, colorKey, fontColorDefaultDefault);
}
if (defaults.getBackgroundColor() != null)
PreferenceConverter.setDefault(preferenceStore, backgroundKey, defaults.getBackgroundColor());
else {
PreferenceConverter.setDefault(preferenceStore, backgroundKey, backgrounColorDefaultDefault);
}
if (defaults.getFontData() != null)
PreferenceConverter.setDefault(preferenceStore, fontKey, defaults.getFontData());
else {
PreferenceConverter.setDefault(preferenceStore, fontKey, fontDataDefaultDefault);
}
preferenceStore.setDefault(styleKey, defaults.getStyle());
// populate
RGB color = PreferenceConverter.getColor(preferenceStore, colorKey);
if (!color.equals(fontColorDefaultDefault))
style.setColor(color);
RGB background = PreferenceConverter.getColor(preferenceStore, backgroundKey);
if (!background.equals(backgrounColorDefaultDefault))
style.setBackgroundColor(background);
FontData[] fontDataArray = PreferenceConverter.getFontDataArray(preferenceStore, fontKey);
if (!Arrays.equals(fontDataArray, fontDataDefaultDefault)) {
style.setFontData(fontDataArray);
}
style.setStyle(preferenceStore.getInt(styleKey));
}
示例7: getValueOfFontListFieldEditor
import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
/**
* FontFieldEditor 의 환경설정 값을 리턴
*
* @param name
* @return FontData[]
*/
public FontData[] getValueOfFontListFieldEditor(String name) {
return PreferenceConverter.getFontDataArray(preferenceStore, name);
}