當前位置: 首頁>>代碼示例>>Java>>正文


Java JFaceResources.getFont方法代碼示例

本文整理匯總了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("");
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:26,代碼來源:DwprofileBrowserInformationControl.java

示例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;
}
 
開發者ID:angelozerr,項目名稱:typescript.java,代碼行數:22,代碼來源:TypeScriptTemplatePreferencePage.java

示例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$
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:24,代碼來源:CustomBrowserInformationControl.java

示例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;
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:22,代碼來源:ThemedDelegatingLabelProvider.java

示例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);
	}
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:22,代碼來源:ThemePreferencePage.java

示例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);
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:20,代碼來源:ThemeUIComposite.java

示例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);
	}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:33,代碼來源:EnginesStatusView.java

示例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);
}
 
開發者ID:sebez,項目名稱:vertigo-chroma-kspplugin,代碼行數:9,代碼來源:KspInformationPresenter.java

示例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);
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:21,代碼來源:DwprofileBrowserInformationControl.java

示例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();
	}
 
開發者ID:grosenberg,項目名稱:fluentmark,代碼行數:29,代碼來源:AppearanceConfigurationBlock.java

示例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;
}
 
開發者ID:angelozerr,項目名稱:typescript.java,代碼行數:32,代碼來源:CodeTemplateBlock.java

示例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);
}
 
開發者ID:yamcs,項目名稱:yamcs-studio,代碼行數:11,代碼來源:EventDetailsDialog.java

示例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);
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:16,代碼來源:CustomBrowserInformationControl.java

示例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;
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:10,代碼來源:ControlThemer.java

示例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);
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:40,代碼來源:TreeThemer.java


注:本文中的org.eclipse.jface.resource.JFaceResources.getFont方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。