当前位置: 首页>>代码示例>>Java>>正文


Java FontRegistry类代码示例

本文整理汇总了Java中org.eclipse.jface.resource.FontRegistry的典型用法代码示例。如果您正苦于以下问题:Java FontRegistry类的具体用法?Java FontRegistry怎么用?Java FontRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FontRegistry类属于org.eclipse.jface.resource包,在下文中一共展示了FontRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
private void init() {
  shell.setLayout(new GridLayout(2, false));
  fontRegistry = new FontRegistry(display);
  fontRegistry.put("button-text", new FontData[]{new FontData("Arial", 9, SWT.BOLD)} );
  fontRegistry.put("code", new FontData[]{new FontData("Courier New", 10, SWT.NORMAL)});
  Text text = new Text(shell, SWT.MULTI | SWT.BORDER | SWT.WRAP);
  text.setFont(fontRegistry.get("code"));
  text.setForeground(display.getSystemColor(SWT.COLOR_BLUE));
  text.setText("public static void main() {\n\tSystem.out.println(\"Hello\"); \n}");
  GridData gd = new GridData(GridData.FILL_BOTH);
  gd.horizontalSpan = 2;
  text.setLayoutData(gd);
  Button executeButton = new Button(shell, SWT.PUSH);
  executeButton.setText("Execute");
  executeButton.setFont(fontRegistry.get("button-text"));
  Button cancelButton = new Button(shell, SWT.PUSH);
  cancelButton.setText("Cancel");
  cancelButton.setFont(fontRegistry.get("button-text"));
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:20,代码来源:FontRegistryExample.java

示例2: XYGraphMediaFactory

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
/**
 * Private constructor to avoid instantiation.
 */
private XYGraphMediaFactory() {
	_colorRegistry = new ColorRegistry();
	_imageRegistry = new ImageRegistry();
	_fontRegistry = new FontRegistry();

	_imageCache = new HashMap<ImageDescriptor, Image>();

	// dispose all images from the image cache, when the display is disposed
	Display.getDefault().addListener(SWT.Dispose, new Listener() {
		public void handleEvent(final Event event) {
			for (Image img : _imageCache.values()) {
				img.dispose();
			}
			disposeResources();
		}
	});

}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:22,代码来源:XYGraphMediaFactory.java

示例3: createContents

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
/**
 * @see org.eclipse.ui.forms.IDetailsPage#createContents(org.eclipse.swt.widgets.Composite)
 */
public void createContents(Composite parent) {
    FormToolkit toolkit = this.managedForm.getToolkit();

    fontRegistry = new FontRegistry(parent.getDisplay());

    // Initializes the parent control.
    parent.setLayout(new FillLayout());

    // Creates the section
    this.section = toolkit.createSection(parent, Section.TITLE_BAR);
    this.section.marginHeight = 5;
    this.section.marginWidth = 10;

    // Createst the section content and its layout
    this.sectionContent = toolkit.createComposite(section);
    this.section.setClient(this.sectionContent);
    GridLayout layout = new GridLayout(1, true);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    this.sectionContent.setLayout(layout);

    // Creates the editor content.
    this.editorContainer = managedForm.getToolkit().createComposite(sectionContent);
    this.editorContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Creates controls displaying the setting note.
    this.noteLabel = this.managedForm.getToolkit().createFormText(sectionContent, false);
    this.noteLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    this.noteLabel.setFont(EMPHASIS, fontRegistry.getItalic(""));
    this.noteLabel.addHyperlinkListener(new MyHyperlinkListener(this));

}
 
开发者ID:anb0s,项目名称:eclox,代码行数:36,代码来源:DetailsPage.java

示例4: initDiffStyleRangeForLineType

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
/**
 * Starts a new {@link StyleRange} given a specific line type.
 */
private StyleRange initDiffStyleRangeForLineType(DiffLineType lineType, int startTextOffset) {
  ColorRegistry reg =
      PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
  StyleRange range = new StyleRange();
  range.start = startTextOffset;
  switch (lineType) {
    case ADD:
      range.foreground = reg.get(THEME_DiffAddForegroundColor);
      range.background = reg.get(THEME_DiffAddBackgroundColor);
      break;
    case REMOVE:
      range.foreground = reg.get(THEME_DiffRemoveForegroundColor);
      range.background = reg.get(THEME_DiffRemoveBackgroundColor);
      break;
    case HUNK:
      range.foreground = reg.get(THEME_DiffHunkForegroundColor);
      range.background = reg.get(THEME_DiffHunkBackgroundColor);
      break;
    case HEADLINE:
      range.foreground = reg.get(THEME_DiffHeadlineForegroundColor);
      range.background = reg.get(THEME_DiffHeadlineBackgroundColor);
      FontRegistry fontReg =
          PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry();
      range.font = fontReg.get(THEME_DiffHeadlineFont);
      break;
    default:
      break;
  }
  return range;
}
 
开发者ID:google,项目名称:git-appraise-eclipse,代码行数:34,代码来源:DiffAttributeEditor.java

示例5: start

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
public void start(BundleContext context) throws Exception
{
  super.start(context);
  plugin = this;
  fontReg = new FontRegistry(Display.getCurrent());

  // initialise some fonts
  fontReg.put(FONT_8, new FontData[]
  {new FontData("Arial", 8, SWT.None)});
  fontReg.put(FONT_10, new FontData[]
  {new FontData("Arial", 10, SWT.None)});
  fontReg.put(FONT_12, new FontData[]
  {new FontData("Arial", 12, SWT.None)});
}
 
开发者ID:debrief,项目名称:limpet,代码行数:15,代码来源:Activator.java

示例6: FontListener

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
/**
 * Create the FontListener. Starts listening to the font registry 
 * provided. It the control already has a FontListener, it is disposed.
 * @param control The control who's font this class will update.
 * @param fontPref The preference this class will update.
 * @param registry The registry to get font preferences from.
 */
private FontListener( Control control, ExternalPreference fontPref,
   FontRegistry registry )
{
   this.control = control;
   this.fontPref = fontPref;
   this.registry = registry;
   
   registry.addListener( this );
   
   
   removeListener( control );
   currentListeners.put( control, this );
}
 
开发者ID:brocade,项目名称:vTM-eclipse,代码行数:21,代码来源:SWTUtil.java

示例7: deriveFontSize

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
private static Font deriveFontSize(Font font, String preferenceKey) {
	int pixelHeight = TIMELINE_PREFERENCES.getInt(preferenceKey);
	if (font == null) {
		font = Display.getDefault().getSystemFont();
	}
	Device device = font.getDevice();
	if (device == null) {
		device = WidgetUtils.getDisplay();
	}
	int pixelsPerInch = device.getDPI().y;
	int pointHeight;
	if (pixelsPerInch == 0) {
		pointHeight = pixelHeight;
	} else {
		pointHeight = POINTS_PER_INCH * pixelHeight / pixelsPerInch;
	}
	FontData[] fontData = font.getFontData();
	for (int i=0; i<fontData.length; i++) {
		fontData[i].setHeight(pointHeight);
	}
	
	String symbolicFontName = font.toString() + "_" + pointHeight;
	FontRegistry fontRegistry = FontUtils.FONT_REGISTRY_INSTANCE;
	boolean fontExists = fontRegistry.getKeySet().contains(symbolicFontName);
	Font desiredFont = null;
	if(!fontExists) {
		desiredFont = FontUtils.getStyledFont(font.getDevice(), fontData);
		fontRegistry.put(symbolicFontName, fontData);
	} else {
		desiredFont = fontRegistry.get(symbolicFontName);
	}
	return desiredFont;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:34,代码来源:TimelineUtils.java

示例8: getBoldFont

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
private Font getBoldFont() {
	Font systemFont = FontUtils.getSystemFont();
	int desiredFontHeight = 10;
	String symbolicFontName = systemFont.toString() + "_" + desiredFontHeight;
	FontRegistry fontRegistry = FontUtils.FONT_REGISTRY_INSTANCE;
	boolean fontExists = fontRegistry.getKeySet().contains(symbolicFontName);
	Font font = null;
	if(!fontExists) {
		font = FontUtils.getStyledFont(desiredFontHeight, SWT.NONE);
		fontRegistry.put(symbolicFontName, font.getFontData());
	} else {
		font = fontRegistry.get(symbolicFontName);
	}
	return font;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:16,代码来源:PageSelectionWidget.java

示例9: initFonts

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
/**
 * Inits the fonts for the dialog.
 * 
 * @param fontRegistry
 *            fontRegistry
 */
public static void initFonts(FontRegistry fontRegistry) {
	FontData[] fontData = JFaceResources.getDialogFontDescriptor().getFontData();
	if (fontData.length > 0) {
		fontData[0].setStyle(SWT.ITALIC);
		fontData[0].setHeight(fontData[0].getHeight() - 1);
	}
	fontRegistry.put("titleLabel", fontData);
	fontRegistry.put("content", JFaceResources.getDialogFontDescriptor().getFontData());
}
 
开发者ID:edgarmueller,项目名称:emfstore-rest,代码行数:16,代码来源:UIDecisionConfig.java

示例10: populateTree

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
protected void populateTree(Map<String, List<UpgradeConflict>> upgradeConflicts) {
    TreeSet<String> sortedComponentTypes = new TreeSet<>();
    sortedComponentTypes.addAll(upgradeConflicts.keySet());

    // loop thru sorted list creating upgrade component tree
    for (String componentType : sortedComponentTypes) {
        // create root component type node
        TreeItem componentTypeTreeItem = new TreeItem(getTreeComponentConflicts(), SWT.NONE);
        componentTypeTreeItem.setText(componentType);
        FontRegistry registry = new FontRegistry();
        Font boldFont = registry.getBold(Display.getCurrent().getSystemFont().getFontData()[0].getName());

        componentTypeTreeItem.setFont(boldFont);
        componentTypeTreeItem.setExpanded(true);

        // loop thru each component instance and create named node
        List<UpgradeConflict> upgradeComponents = upgradeConflicts.get(componentType);
        for (UpgradeConflict upgradeConflict : upgradeComponents) {
            TreeItem componentTreeItem = new TreeItem(componentTypeTreeItem, SWT.NONE);
            componentTreeItem.setText(upgradeConflict.getLocalComponent().getFileName());
            componentTreeItem.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
            componentTreeItem.setData("local", upgradeConflict.getLocalComponent());
            componentTreeItem.setData("remote", upgradeConflict.getRemoteComponent());
            componentTreeItem.setExpanded(true);
        }
    }
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:28,代码来源:UpgradeComponentConflictsComposite.java

示例11: updateSummaryLabel

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
public void updateSummaryLabel(int candidateCnt, String orgUserName) {
    if (lblSummary != null) {
        lblSummary.setText("Found " + candidateCnt + " deployment candidates");
        FontRegistry registry = new FontRegistry();
        Font boldFont = registry.getBold(Display.getCurrent().getSystemFont().getFontData()[0].getName());
        lblSummary.setFont(boldFont);
        lblSummary.update();
    }
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:10,代码来源:DeploymentPlanComposite.java

示例12: getPreferenceFont

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
public static Font getPreferenceFont(Display display, String name) {
	FontRegistry fontRegistry = JFaceResources.getFontRegistry();
	FontData[] fonts = fontRegistry.filterData(getPreferenceFont(name), display);
	if (fonts == null)
		return fontRegistry.defaultFont();
	return new Font(display, fonts);
}
 
开发者ID:DaveVoorhis,项目名称:Rel,代码行数:8,代码来源:Preferences.java

示例13: initFonts

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
private void initFonts()
{
	FontData[] fontData = Display.getCurrent().getSystemFont().getFontData();
	String fontName = fontData[0].getName();
	FontRegistry registry = JFaceResources.getFontRegistry();
	boldFont = registry.getBold(fontName);
}
 
开发者ID:opcoach,项目名称:E34MigrationTooling,代码行数:8,代码来源:PluginDataProvider.java

示例14: updateFontEntries

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
private static void updateFontEntries( Display display ) {
  FontRegistry fontRegistry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry();
  if( fontRegistry.getFontData( "org.eclipse.jface.textfont" )[ 0 ].getName().equals( FONT_FACE ) ) {
    updateFontEntry( display, fontRegistry, "org.eclipse.ui.workbench.texteditor.blockSelectionModeFont" );
    updateFontEntry( display, fontRegistry, "org.eclipse.jface.textfont" );
    updateFontEntry( display, fontRegistry, "org.eclipse.jdt.ui.editors.textfont" );
  }
}
 
开发者ID:fappel,项目名称:xiliary,代码行数:9,代码来源:FontRegistryUpdater.java

示例15: updateFontEntry

import org.eclipse.jface.resource.FontRegistry; //导入依赖的package包/类
private static void updateFontEntry( Display display, FontRegistry fontRegistry, String symbolicName ) {
  Font textFont = fontRegistry.get( symbolicName );
  fontRegistry.put( symbolicName, display.getSystemFont().getFontData() );
  display.readAndDispatch();
  fontRegistry.put( symbolicName, textFont.getFontData() );
  display.readAndDispatch();
}
 
开发者ID:fappel,项目名称:xiliary,代码行数:8,代码来源:FontRegistryUpdater.java


注:本文中的org.eclipse.jface.resource.FontRegistry类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。