本文整理汇总了Java中org.eclipse.jface.resource.JFaceResources.getFont方法的典型用法代码示例。如果您正苦于以下问题:Java JFaceResources.getFont方法的具体用法?Java JFaceResources.getFont怎么用?Java JFaceResources.getFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.resource.JFaceResources
的用法示例。
在下文中一共展示了JFaceResources.getFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTextLayout
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
/**
* <p>
* Creates and initializes the text layout used to compute the size hint.
* </p>
*
* @since 3.2
*/
private void createTextLayout() {
fTextLayout= new TextLayout(fBrowser.getDisplay());
// Initialize fonts
String symbolicFontName= fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName;
Font font = JFaceResources.getFont(symbolicFontName);
fTextLayout.setFont(font);
fTextLayout.setWidth(-1);
font = JFaceResources.getFontRegistry().getBold(symbolicFontName);
fBoldStyle = new TextStyle(font, null, null);
// Compute and set tab width
fTextLayout.setText(" ");
int tabWidth = fTextLayout.getBounds().width;
fTextLayout.setTabs(new int[] {tabWidth});
fTextLayout.setText("");
}
示例2: createViewer
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
protected SourceViewer createViewer(Composite parent) {
IDocument document= new Document();
JavaScriptTextTools tools= JSDTTypeScriptUIPlugin.getDefault().getJavaTextTools();
tools.setupJavaDocumentPartitioner(document, IJavaScriptPartitions.JAVA_PARTITIONING);
IPreferenceStore store= JSDTTypeScriptUIPlugin.getDefault().getCombinedPreferenceStore();
SourceViewer viewer= new JavaSourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL, store);
SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaScriptPartitions.JAVA_PARTITIONING, false);
viewer.configure(configuration);
viewer.setEditable(false);
viewer.setDocument(document);
Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
viewer.getTextWidget().setFont(font);
new TypeScriptSourcePreviewerUpdater(viewer, configuration, store);
Control control= viewer.getControl();
GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
control.setLayoutData(data);
return viewer;
}
示例3: createTextLayout
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
/**
* Creates and initializes the text layout used to compute the size hint.
*
* @since 3.2
*/
private void createTextLayout()
{
fTextLayout = new TextLayout(fBrowser.getDisplay());
// Initialize fonts
String symbolicFontName = fSymbolicFontName == null ? JFaceResources.DIALOG_FONT : fSymbolicFontName;
Font font = JFaceResources.getFont(symbolicFontName);
fTextLayout.setFont(font);
fTextLayout.setWidth(-1);
font = JFaceResources.getFontRegistry().getBold(symbolicFontName);
fBoldStyle = new TextStyle(font, null, null);
// Compute and set tab width
fTextLayout.setText(" "); //$NON-NLS-1$
int tabWidth = fTextLayout.getBounds().width;
fTextLayout.setTabs(new int[] { tabWidth });
fTextLayout.setText(""); //$NON-NLS-1$
}
示例4: getFont
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
public Font getFont(Object element)
{
if (disabled)
{
if (wrapped instanceof IFontProvider)
{
return ((IFontProvider) wrapped).getFont(element);
}
return null;
}
if (!useEditorFont())
{
return null;
}
Font font = JFaceResources.getFont(IThemeManager.VIEW_FONT_NAME);
if (font == null)
{
font = JFaceResources.getTextFont();
}
return font;
}
示例5: setFont
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
private void setFont(String fontId, FontData[] data)
{
String fdString = PreferenceConverter.getStoredRepresentation(data);
// Only set new values if they're different from existing!
Font existing = JFaceResources.getFont(fontId);
String existingString = ""; //$NON-NLS-1$
if (!existing.isDisposed())
{
existingString = PreferenceConverter.getStoredRepresentation(existing.getFontData());
}
if (!existingString.equals(fdString))
{
// put in registry...
JFaceResources.getFontRegistry().put(fontId, data);
// Save to prefs...
ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
String key = ThemeElementHelper.createPreferenceKey(currentTheme, fontId);
IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
store.setValue(key, fdString);
}
}
示例6: setFont
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
private void setFont(String fontId, FontData[] data) {
String fdString = PreferenceConverter.getStoredRepresentation(data);
Font existing = JFaceResources.getFont(fontId);
String existingString = "";
if (!(existing.isDisposed())) {
existingString = PreferenceConverter
.getStoredRepresentation(existing.getFontData());
}
if (existingString.equals(fdString)) {
return;
}
JFaceResources.getFontRegistry().put(fontId, data);
ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
String key = ThemeElementHelper.createPreferenceKey(currentTheme,fontId);
IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
store.setValue(key, fdString);
}
示例7: createPartControl
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
/**
* This is a callback that will allow us
* to create the viewer and initialize it.
*/
public void createPartControl(Composite parent) {
_viewer = new TreeViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
_contentProvider = new ViewContentProvider();
_viewer.setContentProvider(_contentProvider);
ColumnViewerToolTipSupport.enableFor(_viewer);
_viewer.addSelectionChangedListener(
new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
fireEngineSelectionChanged();
}
});
createColumns();
// _viewer.setColumnProperties( new String[] {"Status", "Identifier", "Step", "Status"} );
// _viewer.getTree().setHeaderVisible(true);
Font mono = JFaceResources.getFont(JFaceResources.TEXT_FONT);
_viewer.getTree().setFont(mono);
// Create the help context id for the viewer's control
PlatformUI.getWorkbench().getHelpSystem().setHelp(_viewer.getControl(), "org.eclipse.gemoc.executionframework.ui.views.engine.EngineStatusView");
// register for changes in the RunningEngineRegistry
//org.eclipse.gemoc.executionframework.engine.Activator.getDefault().gemocRunningEngineRegistry.addObserver(this);
buildMenu();
org.eclipse.gemoc.executionframework.engine.Activator.getDefault().gemocRunningEngineRegistry.addEngineRegistrationListener(this);
}
示例8: addStyleRange
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
private void addStyleRange(StyleType styleType, int length) {
int fontStyle = styleType == StyleType.BOLD ? SWT.BOLD : SWT.NONE;
StyleRange range = new StyleRange(offset, length, null, null, fontStyle);
if (styleType == StyleType.FIXED_WIDTH) {
range.font = JFaceResources.getFont(JFaceResources.TEXT_FONT);
}
presentation.addStyleRange(range);
}
示例9: computeSizeConstraints
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
/**
*
* @see
* org.eclipse.jface.text.IInformationControlExtension5#computeSizeConstraints(int,
* int)
*/
public Point computeSizeConstraints(int widthInChars, int heightInChars) {
if (fSymbolicFontName == null) {
return null;
}
GC gc= new GC(fBrowser);
Font font= fSymbolicFontName == null ? JFaceResources.getDialogFont() : JFaceResources.getFont(fSymbolicFontName);
gc.setFont(font);
int width= gc.getFontMetrics().getAverageCharWidth();
int height= gc.getFontMetrics().getHeight();
gc.dispose();
return new Point(widthInChars * width, heightInChars * height);
}
示例10: createPreviewer
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
private Control createPreviewer(Composite parent) {
IPreferenceStore generalTextStore = FluentMkUI.getDefault().getPreferenceStore();
IPreferenceStore store = new ChainedPreferenceStore(new IPreferenceStore[] { getPreferenceStore(),
new PreferencesAdapter(createTemporaryCorePreferenceStore()), generalTextStore });
fPreviewViewer = new FluentMkSourceViewer(parent, null, null, false, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER,
store);
FluentMkSimpleSourceViewerConfiguration configuration = new FluentMkSimpleSourceViewerConfiguration(
fColorManager, store, null, Partitions.MK_PARTITIONING, false);
fPreviewViewer.configure(configuration);
Font font = JFaceResources.getFont(Prefs.EDITOR_TEXT_FONT);
fPreviewViewer.getTextWidget().setFont(font);
new PreviewSourceUpdater(fPreviewViewer, configuration, store);
fPreviewViewer.setEditable(false);
Cursor arrowCursor = fPreviewViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
fPreviewViewer.getTextWidget().setCursor(arrowCursor);
// Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263
// fPreviewViewer.getTextWidget().setCaret(null);
String content = loadPreviewContentFromFile("ColorsPreview.md"); //$NON-NLS-1$
IDocument document = new Document(content);
FluentMkUI.getDefault().getTextTools().setupDocumentPartitioner(document, Partitions.MK_PARTITIONING);
fPreviewViewer.setDocument(document);
return fPreviewViewer.getControl();
}
示例11: createViewer
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
private SourceViewer createViewer(Composite parent, int nColumns) {
Label label = new Label(parent, SWT.NONE);
label.setText(JSDTTypeScriptUIMessages.CodeTemplateBlock_preview);
GridData data = new GridData();
data.horizontalSpan = nColumns;
label.setLayoutData(data);
IDocument document = new Document();
JavaScriptTextTools tools = JavaScriptPlugin.getDefault().getJavaTextTools();
tools.setupJavaDocumentPartitioner(document, IJavaScriptPartitions.JAVA_PARTITIONING);
IPreferenceStore store = JavaScriptPlugin.getDefault().getCombinedPreferenceStore();
SourceViewer viewer = new JavaSourceViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL,
store);
CodeTemplateSourceViewerConfiguration configuration = new CodeTemplateSourceViewerConfiguration(
tools.getColorManager(), store, null, fTemplateProcessor);
viewer.configure(configuration);
viewer.setEditable(false);
viewer.setDocument(document);
Font font = JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT);
viewer.getTextWidget().setFont(font);
new TypeScriptSourcePreviewerUpdater(viewer, configuration, store);
Control control = viewer.getControl();
data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
data.horizontalSpan = nColumns;
data.heightHint = fPixelConverter.convertHeightInCharsToPixels(5);
control.setLayoutData(data);
return viewer;
}
示例12: createDetailArea
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
private void createDetailArea(Composite container)
{
org.eclipse.swt.graphics.Font terminalFont = JFaceResources.getFont(JFaceResources.TEXT_FONT);
final StyledText styledText = new StyledText(container, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
styledText.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).create());
styledText.setEditable(false);
styledText.setText(event.getMessage());
styledText.setAlwaysShowScrollBars(false);
styledText.setFont(terminalFont);
}
示例13: computeSizeConstraints
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
public Point computeSizeConstraints(int widthInChars, int heightInChars)
{
if (fSymbolicFontName == null)
return null;
GC gc = new GC(fBrowser);
Font font = fSymbolicFontName == null ? JFaceResources.getDialogFont() : JFaceResources
.getFont(fSymbolicFontName);
gc.setFont(font);
int width = gc.getFontMetrics().getAverageCharWidth();
int height = gc.getFontMetrics().getHeight();
gc.dispose();
return new Point(widthInChars * width, heightInChars * height);
}
示例14: getFont
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
protected Font getFont()
{
Font font = JFaceResources.getFont(IThemeManager.VIEW_FONT_NAME);
if (font == null)
{
font = JFaceResources.getTextFont();
}
return font;
}
示例15: addMeasureItemListener
import org.eclipse.jface.resource.JFaceResources; //导入方法依赖的package包/类
private void addMeasureItemListener()
{
if (controlIsDisposed())
{
return;
}
final Tree tree = getTree();
// Hack to force a specific row height and width based on font
measureItemListener = new Listener()
{
public void handleEvent(Event event)
{
if (!useEditorFont())
{
return;
}
Font font = JFaceResources.getFont(IThemeManager.VIEW_FONT_NAME);
if (font == null)
{
font = JFaceResources.getTextFont();
}
if (font != null)
{
event.gc.setFont(font);
FontMetrics metrics = event.gc.getFontMetrics();
int height = metrics.getHeight() + 2;
TreeItem item = (TreeItem) event.item;
int width = event.gc.stringExtent(item.getText()).x + 24; // minimum width we need for text plus eye
event.height = height;
if (width > event.width)
{
event.width = width;
}
}
}
};
tree.addListener(SWT.MeasureItem, measureItemListener);
}