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


Java Bullet类代码示例

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


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

示例1: bulletListSelection

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
/**
 * Applies a bullet list style to the currently selected lines.
 */
public void bulletListSelection() {
	if (!getEditable()) {
		return;
	}

	String textBeforeSelection = getText().substring(0, getSelection().x);
	int selectionStartLine = getTextLineCount(textBeforeSelection) - 1;
	int selectionLineCount = getTextLineCount(getSelectionText());
	int selectionCurrentBullets = 0;
	// Count number of lines that currently have a bullet.
	for (int line = selectionStartLine; line < selectionStartLine + selectionLineCount; ++line) {
		if (getLineBullet(line) != null) {
			++selectionCurrentBullets;
		}
	}

	if (selectionCurrentBullets == selectionLineCount) {
		// All lines have bullets, remove them all.
		setLineBullet(selectionStartLine, selectionLineCount, null);
		return;
	}

	Bullet bullet = new Bullet(ST.BULLET_DOT, bulletStyle);
	setLineBullet(selectionStartLine, selectionLineCount, bullet);
}
 
开发者ID:PyvesB,项目名称:Notepad4e,代码行数:29,代码来源:Note.java

示例2: createUI30Hints

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
private void createUI30Hints(final Composite parent) {

		final Composite container = new Composite(parent, SWT.NONE);
		GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(container);
		GridLayoutFactory.fillDefaults().numColumns(1).applyTo(container);
		{
			// use a bulleted list to display this info
			final StyleRange style = new StyleRange();
			style.metrics = new GlyphMetrics(0, 0, 10);
			final Bullet bullet = new Bullet(style);

			final String infoText = Messages.Modify_MapProvider_Label_Hints;
			final int lineCount = Util.countCharacter(infoText, '\n');

			final StyledText styledText = new StyledText(container, SWT.READ_ONLY | SWT.WRAP | SWT.MULTI);
			GridDataFactory.fillDefaults().grab(true, false).applyTo(styledText);
			styledText.setText(infoText);
			styledText.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
			styledText.setLineBullet(1, lineCount, bullet);
			styledText.setLineWrapIndent(1, lineCount, 10);
		}
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:23,代码来源:DialogModifyMapProvider.java

示例3: createUI_76_Hints

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
private void createUI_76_Hints(final Composite parent) {

		// use a bulleted list to display this info
		final StyleRange style = new StyleRange();
		style.metrics = new GlyphMetrics(0, 0, 10);
		final Bullet bullet = new Bullet(style);

		final String infoText = Messages.ColumnModifyDialog_Label_Hints;
		final int lineCount = Util.countCharacter(infoText, '\n');

		final StyledText styledText = new StyledText(parent, SWT.READ_ONLY | SWT.WRAP | SWT.MULTI);
		styledText.setText(infoText);
		styledText.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
		styledText.setLineBullet(1, lineCount, bullet);
		styledText.setLineWrapIndent(1, lineCount, 10);
		GridDataFactory.fillDefaults()//
				.grab(true, false)
				.span(2, 1)
				.applyTo(styledText);
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:21,代码来源:DialogModifyColumns.java

示例4: configureStyledText

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
private void configureStyledText(String text, boolean enabled) {
	if (fStyledText == null)
		return;

	fStyledText.setText(text);
	int count= fStyledText.getCharCount();
	if (count == 0)
		return;

	Color foreground= enabled ? null : Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY);

	fStyledText.setStyleRange(new StyleRange(0, count, foreground, null));

	StyleRange styleRange= new StyleRange(0, count, foreground, null);
	styleRange.metrics= new GlyphMetrics(0, 0, 20);
	fStyledText.setLineBullet(0, fStyledText.getLineCount(), new Bullet(styleRange));

	fStyledText.setEnabled(enabled);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:20,代码来源:BulletListBlock.java

示例5: lineGetStyle

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
@Override
public void lineGetStyle(LineStyleEvent e) {
	// Set the line number
	int line = tc.getLineAtOffset(e.lineOffset);
	int lastLine = tc.getLineCount() - 1;

	e.bulletIndex = line;

	String prompt = "gdb>";

	// Set the style, 12 pixles wide for each digit
	StyleRange style = new StyleRange();
	style.metrics = new GlyphMetrics(0, 0, prompt.length() * 12);

	// Create and set the bullet
	e.bullet = new Bullet(ST.BULLET_TEXT, style);
	if (line == lastLine) {
		e.bullet.text = prompt;
	} else {
		e.bullet.text = "";
	}
}
 
开发者ID:AndersDala,项目名称:eclipse-debug-console-history,代码行数:23,代码来源:StyledTextConsolePage.java

示例6: applyBlockTags

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
private String applyBlockTags(final List<String> inLines,
        final StyledText inWidget) {
	int lLine = 0;
	final int lLength = inWidget.getLineCount();

	final ListSerializer lRoot = new ListSerializer(null, lLine, null);
	ListSerializer lSerializer = lRoot;
	while (lLine < lLength) {
		final Bullet lBullet = inWidget.getLineBullet(lLine);
		if (lBullet != null) {
			lSerializer = lSerializer.processBullet(lBullet, lLine);
		} else {
			lSerializer = lSerializer.consolidate(lLine, lRoot);
		}
		lLine++;
	}
	lSerializer.consolidate(lLength, lRoot);
	return lRoot.render(inLines);
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:20,代码来源:StyleParser.java

示例7: getTagTemplate

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
private TagTemplate getTagTemplate(final Bullet inBullet) {
	final String template = "<%s %s=\"%%s\">%%s</%s>"; //$NON-NLS-1$
	final String item_template = "<li>%s</li>"; //$NON-NLS-1$

	String list_template = "<ul indent=\"%s\">%s</ul>"; //$NON-NLS-1$
	if ((inBullet.type & ST.BULLET_DOT) != 0) {
		list_template = String.format(template, ListTag.Unordered.getName(),
		        INDENT_ATTR, ListTag.Unordered.getName());
	} else if ((inBullet.type & ST.BULLET_CUSTOM) != 0) {
		list_template = String.format(template,
		        ListTag.OrderedNumeric.getName(), INDENT_ATTR,
		        ListTag.OrderedNumeric.getName());
	} else if ((inBullet.type & ST.BULLET_LETTER_UPPER) != 0) {
		list_template = String.format(template,
		        ListTag.OrderedLetterUpper.getName(), INDENT_ATTR,
		        ListTag.OrderedLetterUpper.getName());
	} else if ((inBullet.type & ST.BULLET_LETTER_LOWER) != 0) {
		list_template = String.format(template,
		        ListTag.OrderedLetterLower.getName(), INDENT_ATTR,
		        ListTag.OrderedLetterLower.getName());
	}

	return new TagTemplate(list_template, item_template);
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:25,代码来源:StyleParser.java

示例8: processBullet

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
/**
 * Processed the specified bullet. Check's whether the specified bullet
 * belongs to the acutal list, the parent list or a new sublist.
 *
 * @param inBullet
 *            Bullet
 * @param inLine
 *            int line index
 * @return BulletSerializer either the actual, the parent or a new
 *         sublist's serializer.
 */
public ListSerializer processBullet(final Bullet inBullet,
        final int inLine) {
	// we're still in the same list
	if (inBullet == bullet) {
		return this;
	}

	// we returned to the parent list
	final ListSerializer lAncestor = getAncestor(inBullet);
	if (lAncestor != null) {
		return consolidate(inLine, lAncestor);
	}

	// create new list or sublist
	endLine = inLine; // at this line, we switched to another bullet
	return new ListSerializer(inBullet, inLine, this);
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:29,代码来源:StyleParser.java

示例9: doIndent

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
private boolean doIndent(final Point inLineSelection) {
	final int lBlockStart = inLineSelection.x;
	final Bullet lBullet = widget.getLineBullet(lBlockStart);
	if (lBullet == null) {
		return false;
	}
	if (lBlockStart > 0) {
		final Bullet lBulletBefore = widget.getLineBullet(lBlockStart - 1);
		if (lBulletBefore == null) {
			return false;
		}
		if (lBullet.hashCode() == lBulletBefore.hashCode()) {
			return true;
		}
	}
	return false;
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:18,代码来源:TextStyler.java

示例10: dedentLines

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
/**
 * Remove indent of the selected or (if no selection) actual line.
 */
public void dedentLines() {
	final Point lLineSelection = getLineSelection();
	Bullet lBullet = widget.getLineBullet(lLineSelection.x);
	// do we have to merge the selection with the preceding line style?
	if (lLineSelection.x > 0) {
		lBullet = searchFistDifferentBullet(lLineSelection.x, lBullet);
	} else {
		final int lIndent = Math.max(Styles.BULLET_WIDTH,
		        lBullet.style.metrics.width - Styles.INDENT);
		lBullet = Styles.getBullet(lBullet.type, lIndent);
	}
	widget.setLineBullet(lLineSelection.x, lLineSelection.y, null);
	widget.setLineBullet(lLineSelection.x, lLineSelection.y, lBullet);
	widget.redraw();
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:19,代码来源:TextStyler.java

示例11: unformatSelectedBlock

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
private void unformatSelectedBlock(final int inLineStart,
        final int inLineCount) {
	final Bullet lOldBullet = widget.getLineBullet(inLineStart);
	widget.setLineBullet(inLineStart, inLineCount, null);
	// check for nested lists
	if (inLineStart == 0) {
		return;
	}
	final Bullet lBullet = widget.getLineBullet(inLineStart - 1);
	if (lBullet == null) {
		return;
	}
	// the bullet of the preceding line is different, therefore, apply it to
	// the actual lines
	if (lBullet != lOldBullet) {
		widget.setLineBullet(inLineStart, inLineCount, lBullet);
	}
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:19,代码来源:TextStyler.java

示例12: buildMainModelStyle

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
private Bullet buildMainModelStyle() {
	StyleRange style = new StyleRange();
	style.metrics = new GlyphMetrics(0, 0, 40);
	style.foreground = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
	Bullet bullet = new Bullet(style);
	return bullet;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:8,代码来源:TestPresentationPage.java

示例13: buildAdditionalTitleModelStyle

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
private Bullet buildAdditionalTitleModelStyle() {
	StyleRange style = new StyleRange();
	style.metrics = new GlyphMetrics(0, 0, 40);
	style.foreground = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
	Bullet bullet = new Bullet(style);
	return bullet;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:8,代码来源:TestPresentationPage.java

示例14: buildCheckedlStyle

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
private Bullet buildCheckedlStyle() {
	StyleRange style2 = new StyleRange();
	style2.metrics = new GlyphMetrics(0, 0, 80);
	style2.foreground = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
	Bullet bullet = new Bullet(ST.BULLET_TEXT, style2);
	bullet.text = "\u2713";
	return bullet;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:9,代码来源:TestPresentationPage.java

示例15: lineGetStyle

import org.eclipse.swt.custom.Bullet; //导入依赖的package包/类
public void lineGetStyle(LineStyleEvent e) {
	int lineStart = e.lineOffset;
	int lineEnd = lineStart + e.lineText.length();
	// Set the line number
	e.bulletIndex = text.getLineAtOffset(lineStart);
	
	// Set the style, 12 pixels wide for each digit
	StyleRange style = new StyleRange();
	style.foreground = new Color(text.getDisplay(), 120, 120, 120);
	style.fontStyle = SWT.ITALIC;
	style.metrics = new GlyphMetrics(0, 0, Integer.toString(text.getLineCount() + 1).length() * 12);
	// Create and set the bullet
	e.bullet = new Bullet(ST.BULLET_NUMBER, style);
	
	List<StyleRange> ranges = Lists.newArrayList();
	for(TermOccurrence occ:FileEditorPart.this.occurrences) {
		if((occ.getBegin() < lineEnd && occ.getEnd() > lineStart)) {
			int styleStart = Ints.max(occ.getBegin(), lineStart);
			int styleEnd = Ints.min(occ.getEnd(), lineEnd);
			int overlap = styleEnd - styleStart;
			StyleRange styleRange = new StyleRange();
			styleRange.start = styleStart;
			styleRange.length =  overlap;
			if(occ.equals(activeOccurrence)) {
				styleRange.fontStyle = SWT.BOLD | SWT.ITALIC;
				styleRange.background = COLOR_CYAN;
			} else {
				styleRange.background = COLOR_GRAY;						
			}
				
			ranges.add(styleRange);
		}
	}
	e.styles = ranges.toArray(new StyleRange[ranges.size()]);
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:36,代码来源:FileEditorPart.java


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