本文整理匯總了Java中org.eclipse.jface.resource.JFaceResources.getTextFont方法的典型用法代碼示例。如果您正苦於以下問題:Java JFaceResources.getTextFont方法的具體用法?Java JFaceResources.getTextFont怎麽用?Java JFaceResources.getTextFont使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.resource.JFaceResources
的用法示例。
在下文中一共展示了JFaceResources.getTextFont方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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;
}
示例2: initFormText
import org.eclipse.jface.resource.JFaceResources; //導入方法依賴的package包/類
public static void initFormText(FormText formText) {
formText.setWhitespaceNormalized(false);
Font formTextFont = formText.getFont();
FontData formTextFontData = formTextFont.getFontData()[0];
FontData h1FontData = new FontData(formTextFontData.getName(), formTextFontData.getHeight() + 5, SWT.BOLD);
final Font h1Font = new Font(formTextFont.getDevice(), h1FontData);
formText.setFont(FONT_H1_KEY, h1Font);
FontData h3FontData = new FontData(formTextFontData.getName(), formTextFontData.getHeight() + 3, SWT.BOLD);
final Font h3Font = new Font(formTextFont.getDevice(), h3FontData);
formText.setFont(FONT_H3_KEY, h3Font);
Font codeFont = JFaceResources.getTextFont();
formText.setFont(FONT_CODE_KEY, codeFont);
formText.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
h1Font.dispose();
h3Font.dispose();
}
});
// Set fontKeySet = JFaceResources.getFontRegistry().getKeySet();
// if (fontKeySet != null) {
// for (Object fontKey : fontKeySet) {
// System.out.println(fontKey);
// }
// }
}
示例3: createClient
import org.eclipse.jface.resource.JFaceResources; //導入方法依賴的package包/類
/**
* Fill the section.
*/
private void createClient(Section section, FormToolkit toolkit) {
Composite container = toolkit.createComposite(section);
section.setClient(container);
container.setLayout(new GridLayout());
MarkupLanguage language = new MarkdownLanguage();
markupViewer = new MarkupSourceViewer(container, null, SWT.WRAP | SWT.V_SCROLL, language);
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
markupViewer.getControl().setLayoutData(gridData);
MarkupSourceViewerConfiguration configuration = new MarkupSourceViewerConfiguration(EditorsUI.getPreferenceStore());
Font font = JFaceResources.getTextFont();
markupViewer.getTextWidget().setFont(font);
configuration.setMarkupLanguage(language);
markupViewer.configure(configuration);
markupViewer.setEditable(true);
markupViewer.getTextWidget().setData("textViewer", markupViewer);
markupViewer.getTextWidget().setData(MarkupLanguage.class.getName(), language);
markupViewer.getTextWidget().setData(ISourceViewer.class.getName(), markupViewer);
// install common text support such as content assist
IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
CommonTextSupport textSupport = new CommonTextSupport(handlerService);
textSupport.install(markupViewer, true);
getSite().setSelectionProvider(markupViewer.getSelectionProvider());
configure(markupViewer, new Document());
}
示例4: createDialogArea
import org.eclipse.jface.resource.JFaceResources; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
boolean isWin32 = Util.isWindows();
GridLayoutFactory.fillDefaults().extendedMargins(isWin32 ? 0 : 3, 3, 2, 2).applyTo(composite);
List<String> list = history.toList();
String[] items = list.toArray(new String[list.size()]);
Combo comboBox = SWTFactory.createCombo(composite, SWT.NONE, 2, items);
Font terminalFont = JFaceResources.getTextFont();
comboBox.setFont(terminalFont);
GridData textLayoutData = new GridData();
textLayoutData.horizontalAlignment = GridData.FILL;
textLayoutData.verticalAlignment = GridData.FILL;
textLayoutData.grabExcessHorizontalSpace = true;
textLayoutData.grabExcessVerticalSpace = false;
textLayoutData.horizontalSpan = 2;
comboBox.setLayoutData(textLayoutData);
comboBox.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent event) {
if (event.character == '\r' ){
inputText = comboBox.getText();
if (inputText!=null){
if (! inputText.equals(history.current())){
/* when not same as current history entry, add it to history*/
history.add(inputText);
}
}
close();
}
}
});
return composite;
}
示例5: 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;
}
示例6: 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);
}
示例7: applyStyles
import org.eclipse.jface.resource.JFaceResources; //導入方法依賴的package包/類
@Override
public void applyStyles(TextStyle textStyle)
{
if (maxHeightTextFont != null)
{
// Use font with limited max height
textStyle.font = maxHeightTextFont;
}
else
{
textStyle.font = JFaceResources.getTextFont();
}
}
示例8: newDefaultFont
import org.eclipse.jface.resource.JFaceResources; //導入方法依賴的package包/類
private Font newDefaultFont(int id) {
Display display = Display.getCurrent();
int bump = 0;
Font fontCopy = null;
switch (id) {
case DIALOG_FONT:
fontCopy = JFaceResources.getDialogFont();
break;
case TABLE_FONT:
fontCopy = JFaceResources.getDefaultFont();
if (GUI.isMac())
bump = -1;
break;
case TEXT_FONT:
fontCopy = JFaceResources.getTextFont();
break;
case HEADER_FONT:
fontCopy = JFaceResources.getDefaultFont();
break;
case TREE_FONT:
fontCopy = JFaceResources.getTextFont();
break;
default:
break;
}
FontData fd;
if (fontCopy != null)
fd = fontCopy.getFontData()[0];
else
fd = display.getSystemFont().getFontData()[0];
int size = Math.round(fd.getHeight()) + bump;
Font f = new Font(display, fd.getName(), size, 0);
FontData ff = f.getFontData()[0];
return f;
}
示例9: EULAControl
import org.eclipse.jface.resource.JFaceResources; //導入方法依賴的package包/類
public EULAControl(final Composite parent, final int style) {
super(parent, style);
final GridLayout layout = new GridLayout(1, false);
layout.horizontalSpacing = getHorizontalSpacing();
layout.verticalSpacing = getVerticalSpacing();
layout.marginWidth = 0;
layout.marginHeight = 0;
setLayout(layout);
final Label descriptionText = new Label(this, SWT.WRAP | SWT.READ_ONLY);
descriptionText.setText(Messages.getString("EulaControl.DescriptionText")); //$NON-NLS-1$
GridDataBuilder.newInstance().hGrab().hFill().applyTo(descriptionText);
final Text eulaText = new Text(this, SWT.READ_ONLY | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
AutomationIDHelper.setWidgetID(eulaText, EULA_TEXTBOX_ID);
eulaText.setText(EULAText.getEULAText());
eulaText.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
eulaText.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND));
GridDataBuilder.newInstance().hGrab().hFill().vGrab().vFill().applyTo(eulaText);
final Font font = JFaceResources.getTextFont();
if (font != null) {
eulaText.setFont(font);
}
ControlSize.setCharHeightHint(eulaText, 10);
ControlSize.setCharWidthHint(eulaText, 80);
// TODO: This is a work around for a linux layout problem. We may have
// to revisit this and other issues with the wizard when we update for
// localization.
ControlSize.setCharHeightHint(descriptionText, 3);
ControlSize.setCharWidthHint(descriptionText, 80);
acceptButton = new Button(this, SWT.CHECK);
AutomationIDHelper.setWidgetID(acceptButton, ACCEPT_CHECKBOX_ID);
acceptButton.setText(Messages.getString("EulaControl.AcceptButtonText")); //$NON-NLS-1$
acceptButton.setSelection(accepted);
acceptButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
accepted = acceptButton.getSelection();
notifyListeners();
}
});
GridDataBuilder.newInstance().hGrab().applyTo(acceptButton);
}
示例10: getFont
import org.eclipse.jface.resource.JFaceResources; //導入方法依賴的package包/類
@Override
public Font getFont(Object element) {
return JFaceResources.getTextFont();
}
示例11: getFont
import org.eclipse.jface.resource.JFaceResources; //導入方法依賴的package包/類
/**
* This is a TextViewer (usually editor contents), so use the text font explicitly, not the view font we set up in
* parent class.
*/
protected Font getFont()
{
return JFaceResources.getTextFont();
}