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


Java TextStyle类代码示例

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


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

示例1: PluginsSWT

import org.eclipse.swt.graphics.TextStyle; //导入依赖的package包/类
public PluginsSWT(Shell shell, List<String> lines) {
    super(shell);
    this.pluginsBean = new PluginsBean(lines);
    
    target = pluginsBean.getPlugins();
    source = Stream.of(Plugin.values())
            .filter(p -> ! target.contains(p))
            .collect(Collectors.toList());
    targetOriginal = target.stream().collect(Collectors.toList());
    
    rowColorTitle = new Color(display, 70, 130, 180);
    int color = myOS == OS.Mac ? 249 : 239;
    rowColorBack = new Color(display, color, color, color);
    rowColorSelection = display.getSystemColor(SWT.COLOR_WHITE);
  
    fontAwesome = loadCustomFont(getFontAwesomeSize());
    fontGap = new Font(display, fontName, 4, SWT.NORMAL);
    rowTitleFont = new Font(display, fontName, getTopFontSize(), SWT.BOLD);
    rowTextFont = new Font(display, fontName, getTopFontSize() - 2, SWT.NORMAL);
    styleTitle = new TextStyle(rowTitleFont, rowColorTitle, null);
    styleGap = new TextStyle(fontGap, display.getSystemColor(SWT.COLOR_BLACK), null);
    styleRow = new TextStyle(rowTextFont, display.getSystemColor(SWT.COLOR_BLACK), null);
    styleTitleSelected = new TextStyle(rowTitleFont, rowColorSelection, null);
    styleRowSelected = new TextStyle(rowTextFont, rowColorSelection, null);
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:26,代码来源:PluginsSWT.java

示例2: createTextLayout

import org.eclipse.swt.graphics.TextStyle; //导入依赖的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

示例3: setFont

import org.eclipse.swt.graphics.TextStyle; //导入依赖的package包/类
/***************************************************************************
 * Set the font to use
 * 
 * @param font
 **************************************************************************/
@Override
public void setFont(Font font)
{
	String face = font.getFontData()[0].getName();
	int size = font.getFontData()[0].getHeight();
	int style = font.getFontData()[0].getStyle() | SWT.NORMAL;

	FontData newData = new FontData(face, size, style);

	Font newFont = new Font(Display.getDefault(), newData);
	if (m_codeFont != null)
	{
		m_codeFont.dispose();
	}
	m_codeFont = newFont;
	m_defaultStyle = new TextStyle(m_codeFont, Display.getCurrent().getSystemColor(SWT.COLOR_BLACK), null);
	m_selectedStyle = new TextStyle(m_codeFont, Display.getCurrent().getSystemColor(SWT.COLOR_WHITE), null);
	m_highlightedStyle = new TextStyle(m_codeFont, Display.getCurrent().getSystemColor(SWT.COLOR_BLACK), null);
}
 
开发者ID:Spacecraft-Code,项目名称:SPELL,代码行数:25,代码来源:BasicStyleScheme.java

示例4: createTextLayout

import org.eclipse.swt.graphics.TextStyle; //导入依赖的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

示例5: highlightedTerms

import org.eclipse.swt.graphics.TextStyle; //导入依赖的package包/类
public void highlightedTerms(List<String> terms) {
	if (!isValid()) {
		return;
	}
	StyledText styledText = cellEditor.viewer.getTextWidget();
	String text = styledText.getText();
	char[] source = text.toCharArray();
	List<StyleRange> ranges = new ArrayList<StyleRange>();
	TextStyle style = new TextStyle(cellEditor.getSegmentViewer().getTextWidget().getFont(), null,
			ColorConfigBean.getInstance().getHighlightedTermColor());
	for (String term : terms) {
		if (XliffEditorParameter.getInstance().isShowNonpirnttingCharacter()) {
			term = term.replaceAll("\\n", Constants.LINE_SEPARATOR_CHARACTER + "\n");
			term = term.replaceAll("\\t", Constants.TAB_CHARACTER + "\u200B");
			term = term.replaceAll(" ", Constants.SPACE_CHARACTER + "\u200B");
		}
		ranges.addAll(calculateTermsStyleRange(source, term.toCharArray(), style));
	}
	for (StyleRange range : ranges) {
		styledText.setStyleRange(range);
	}
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:23,代码来源:HsMultiCellEditor.java

示例6: configure

import org.eclipse.swt.graphics.TextStyle; //导入依赖的package包/类
public static void configure(TextLayout textLayout) {
	String text = textLayout.getText();
	Document doc = new Document(text);
	ITokenScanner scanner = getRecipeScanner(doc);
	scanner.setRange(doc, 0, doc.getLength());
	IToken token;
	while ((token = scanner.nextToken()) != Token.EOF) {
		int offset = scanner.getTokenOffset();
		int length = scanner.getTokenLength();
		Object data = token.getData();
		if (data != null && data instanceof TextStyle) {
			TextStyle textStyle = (TextStyle) data;
			textLayout.setStyle(textStyle, offset, offset + length - 1);
		}
	}
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:17,代码来源:TagStyleConfigurator.java

示例7: configure

import org.eclipse.swt.graphics.TextStyle; //导入依赖的package包/类
public static void configure(TextLayout textLayout) {
	String text = textLayout.getText();
	Document doc = new Document(text);
	ITokenScanner scanner = getRecipeScanner(doc);
	scanner.setRange(doc, 0, doc.getLength());
	IToken token;
	while ((token = scanner.nextToken()) != Token.EOF) {
		int offset = scanner.getTokenOffset();
		int length = scanner.getTokenLength();
		Object data = token.getData();
		if (data != null && data instanceof TextStyle) {
			TextStyle textStyle = (TextStyle) data;
			textLayout.setStyle(textStyle, offset, offset + length - 1);
		}
	}
	scanner = null;
	doc = null;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:19,代码来源:TagStyleConfigurator.java

示例8: ConcordanceSearchDialog

import org.eclipse.swt.graphics.TextStyle; //导入依赖的package包/类
/**
 * 构造方法
 * @param parentShell
 * @param file
 *            当前文件
 * @param strSrcLang
 *            当前文件的源语言
 * @param strTgtLang
 *            当前文件的目标语言
 * @param strSearchText
 *            搜索文本
 */
public ConcordanceSearchDialog(Shell parentShell, IFile file, String strSrcLang, String strTgtLang,
		String strSearchText) {
	super(parentShell);

	FontData fontData = JFaceResources.getDefaultFont().getFontData()[0];
	fontData.setStyle(fontData.getStyle() | SWT.BOLD);
	font = new Font(Display.getDefault(), fontData);
	style = new TextStyle(font, null, null);

	this.strSrcLang = strSrcLang;
	this.strTgtLang = strTgtLang;
	this.strSearchText = strSearchText;
	ProjectConfiger projectConfig = ProjectConfigerFactory.getProjectConfiger(file.getProject());
	lstDatabase = projectConfig.getAllTmDbs();
	filterUnAvaliableDatabase();
	setHelpAvailable(true);
	setBlockOnOpen(false);
	lstSearchHistory = new ArrayList<String>(HISTORY_SIZE - 1);
	lstFilterHistory = new ArrayList<String>(HISTORY_SIZE - 1);
	if (!Util.isLinux()) {
		totalWidth = 910;
	}
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:36,代码来源:ConcordanceSearchDialog.java

示例9: getStyledText

import org.eclipse.swt.graphics.TextStyle; //导入依赖的package包/类
@Override
public StyledString getStyledText(Object element) {
	if(element instanceof IExplorerNode){
		
		IExplorerNode node = (IExplorerNode)element;
	
		return new StyledString(node.getName(), new Styler() {
			
			@Override
			public void applyStyles(TextStyle textStyle) {
				textStyle.foreground = ColorResources.COLOR_CS_BLUE_DARK;						
			}
			
		});
		
	}
	return null;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:19,代码来源:AlternativeResourceNode.java

示例10: highlightedTerms

import org.eclipse.swt.graphics.TextStyle; //导入依赖的package包/类
public void highlightedTerms(List<String> terms) {
	if (!isValid()) {
		return;
	}
	StyledText styledText = cellEditor.viewer.getTextWidget();
	String text = styledText.getText();
	char[] source = text.toCharArray();
	List<StyleRange> ranges = new ArrayList<StyleRange>();
	TextStyle style = new TextStyle(cellEditor.getSegmentViewer().getTextWidget().getFont(), null,
			ColorConfigBean.getInstance().getHighlightedTermColor());
	for (String term : terms) {
		ranges.addAll(calculateTermsStyleRange(source, term.toCharArray(), style));
	}
	for (StyleRange range : ranges) {
		styledText.setStyleRange(range);
	}
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:18,代码来源:HsMultiCellEditor.java

示例11: BlockControlImage

import org.eclipse.swt.graphics.TextStyle; //导入依赖的package包/类
public BlockControlImage ( final ControlImage controlImage, final int style, final RegistrationManager registrationManager )
{
    super ( controlImage.getClientSpace (), style );

    this.controlImage = controlImage;

    this.registrationManager = registrationManager;

    setLayout ( new FillLayout () );

    this.icon = new Label ( this, SWT.NONE );
    this.icon.setImage ( getEmptyImage () );
    this.icon.addMouseListener ( new MouseAdapter () {
        @Override
        public void mouseUp ( final MouseEvent e )
        {
            toggleBlock ();
        }
    } );

    this.registrationManager.addListener ( this );

    final LocalResourceManager resources = new LocalResourceManager ( JFaceResources.getResources (), this.icon );

    this.boldFont = resources.createFont ( JFaceResources.getDefaultFontDescriptor ().withStyle ( SWT.BOLD ) );
    this.boldStyler = new Styler () {

        @Override
        public void applyStyles ( final TextStyle textStyle )
        {
            textStyle.font = BlockControlImage.this.boldFont;
        }
    };
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:35,代码来源:BlockControlImage.java

示例12: provideTreeCellLabelDecorations

import org.eclipse.swt.graphics.TextStyle; //导入依赖的package包/类
private void provideTreeCellLabelDecorations(ViewerCell cell) {
    TreeElement el = (TreeElement) cell.getElement();
    List<StyleRange> styles = new ArrayList<>();

    Image icon = Activator.getDbObjImage(el.getType());
    String name = el.getName();

    if(btnDebugView.getSelection()) {
        cell.setText(String.format("%s:%s:%s", //$NON-NLS-1$
                el.getType(), name, el.getSide()));
    } else {
        StringBuilder label = new StringBuilder(name);

        if(el.getType() == DbObjType.DATABASE
                || el.getType() == DbObjType.SCHEMA
                || el.getType() == DbObjType.TABLE) {
            label.append(" (") //$NON-NLS-1$
            .append(el.countChildren())
            .append(") [") //$NON-NLS-1$
            .append(el.countDescendants())
            .append(']');

            TextStyle styleGray = new TextStyle();
            styleGray.foreground = getDisplay().getSystemColor(
                    SWT.COLOR_GRAY);

            StyleRange styleCount = new StyleRange(styleGray);
            styleCount.start = name.length();
            styleCount.length = label.length() - name.length();

            styles.add(styleCount);
        }

        cell.setText(label.toString());
    }

    cell.setStyleRanges(styles.toArray(new StyleRange[styles.size()]));
    cell.setImage(icon);
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:40,代码来源:DiffTreeViewer.java

示例13: getStylesFromProperties

import org.eclipse.swt.graphics.TextStyle; //导入依赖的package包/类
/**
 * �������ļ���ԭ������ʽ��text
 * 
 * @param p����������ʽ�������ļ�
 * @param text
 *            ҪӦ��������ʽ��StyledText���
 */
public void getStylesFromProperties(Properties p, StyledText text) {
	String start, length, font, fontstyle, strikeout, underline, fontheight;
	for (int i = 0; i > -1; i++) {
		start = p.getProperty(i + "start");
		if (start != null) {
			length = p.getProperty(i + "length");
			font = p.getProperty(i + "font");
			fontheight = p.getProperty(i + "fontheight");
			fontstyle = p.getProperty(i + "fontstyle");
			strikeout = p.getProperty(i + "strikeout");
			underline = p.getProperty(i + "underline");
			if (Integer.valueOf(fontheight) >= 0) {
				Font f = SWTResourceManager.getFont(font, b.getZoomedFontSize(Integer.valueOf(fontheight)),
						Integer.valueOf(fontstyle));
				TextStyle ts = new TextStyle(f, null, null);
				ts.strikeout = Boolean.valueOf(strikeout);
				ts.underline = Boolean.valueOf(underline);
				StyleRange sr = new StyleRange(ts);
				sr.start = Integer.valueOf(start);
				sr.length = Integer.valueOf(length);
				if (sr.start >= 0 && sr.length + sr.start <= text.getCharCount())
					text.setStyleRange(sr);
			} else
				getMessageBox("��ȡ�ļ�ʱ����", "black�ļ��е���ʽ���԰�����������߶Ȳ���Ϊ��ֵ��");
		} else
			break;
	}
	for (int a = 0; a > -1; ++a) {
		String startline = p.getProperty(a + "alignmentstartline");
		if (startline != null) {
			text.setLineAlignment(Integer.valueOf(startline), 1, Integer.valueOf(p.getProperty(a + "alignment")));
		} else
			break;
	}
}
 
开发者ID:piiiiq,项目名称:Black,代码行数:43,代码来源:blackAction.java

示例14: applyStyles

import org.eclipse.swt.graphics.TextStyle; //导入依赖的package包/类
@Override
public void applyStyles(TextStyle textStyle) {
	if (stylerDescriptor.font != null) {
		textStyle.font = stylerDescriptor.font;
	}
	if (stylerDescriptor.foreground != null) {
		textStyle.foreground = stylerDescriptor.foreground;
	}
	if (stylerDescriptor.backGround != null) {
		textStyle.background = stylerDescriptor.backGround;
	}
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:13,代码来源:StylerProvider.java

示例15: applyStyles

import org.eclipse.swt.graphics.TextStyle; //导入依赖的package包/类
@Override
public void applyStyles(TextStyle textStyle) {
	textStyle.strikeout = (xtextTextStyle.getStyle() & TextAttribute.STRIKETHROUGH) != 0;
	textStyle.underline = (xtextTextStyle.getStyle() & TextAttribute.UNDERLINE) != 0;
	if (xtextTextStyle.getFontData() == null
			&& xtextTextStyle.getStyle() != org.eclipse.xtext.ui.editor.utils.TextStyle.DEFAULT_FONT_STYLE) {
		FontData fontData = new FontData();
		fontData.setStyle(xtextTextStyle.getStyle());
		xtextTextStyle.setFontData(fontData);
	}
	textStyle.font = fontFromFontData(xtextTextStyle.getFontData());
	if (xtextTextStyle.getBackgroundColor() != null) 
		textStyle.background = colorFromRGB(xtextTextStyle.getBackgroundColor());
	textStyle.foreground = colorFromRGB(xtextTextStyle.getColor());
}
 
开发者ID:cplutte,项目名称:bts,代码行数:16,代码来源:StylerFactory.java


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