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


Java StyleRange类代码示例

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


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

示例1: updateHighlighting

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
/**
 * Updates the syntax highlighting.
 *
 * Disables highlighting for inactive blocks, or for all blocks if the editor is disabled.
 */
private void updateHighlighting() {
	if (!getEnabled()) {
		unhighlightAll();
		return;
	}
	if (contentBlocks == null) {
		return;
	}

	int accumulatedOffset = 0;
	for (ContentBlock block : contentBlocks) {
		if (!block.highlighted) {
			StyleRange range = new StyleRange(accumulatedOffset, block.content.length(), inactiveColor, null);
			sourceViewer.getTextWidget().setStyleRange(range);
		}
		accumulatedOffset += block.content.length();
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:WizardPreviewProvider.java

示例2: asyncDisplayMessages

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
private void asyncDisplayMessages() {
	Message m = null;
	synchronized (msgStack) {
		if (msgStack.isEmpty())
			return;

		m = msgStack.pop();
	}
	int offsetStart = errorText.getCharCount();
	errorText.append(m.msg + "\n");
	int offsetEnd = errorText.getCharCount();
	errorText.setTopIndex(errorText.getLineCount() - 1);

	if (m.color != null) {
		StyleRange range = new StyleRange(offsetStart, offsetEnd - offsetStart, m.color, null);
		errorText.setStyleRange(range);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:SpecProcessPage.java

示例3: appendEvents

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
private void appendEvents(StringBuilder builder, List<StyleRange> styles) {
    UsageEventType[] events = EventRegister.getInstance().getRegisteredEventTypes();
    if (events.length > 0) {
        appendLabeledValue(Messages.UsageReportPreferencePage_Events, "", builder, styles);
        builder.append(UIConsts._NL);
        for (UsageEventType event : events) {
            appendLabeledValue(Messages.UsageReportPreferencePage_EventComponent, event.getComponentName(), builder, styles);
            appendLabeledValue(Messages.UsageReportPreferencePage_EventVersion, event.getComponentVersion(), builder, styles);
            appendLabeledValue(Messages.UsageReportPreferencePage_EventAction, event.getActionName(), builder, styles);
            if(event.getValueDescription() != null) {
                appendLabeledValue(Messages.UsageReportPreferencePage_EventValue, event.getValueDescription(), builder, styles);
            }

            builder.append(UIConsts._NL);
        }
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:18,代码来源:UsageReportPreferencePage.java

示例4: setStyledText

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
private void setStyledText(ViewerCell cell, TreeObject obj) {
	/* Calcul du texte. */
	String mainText = obj.getMainText();
	if (mainText == null) {
		return;
	}
	String subText = obj.getSubText();
	String subTextFinal = subText == null ? "" : (" : " + subText);
	String fullText = mainText + subTextFinal;
	cell.setText(fullText);

	/* Calcul du style. */
	List<StyleRange> styles = new ArrayList<>();
	StyleRange styleMainText = new StyleRange(0, mainText.length(), null, null);
	styles.add(styleMainText);
	if (!subTextFinal.isEmpty()) {
		Display display = Display.getCurrent();
		Color blue = display.getSystemColor(SWT.COLOR_DARK_YELLOW);
		StyleRange styleSubText = new StyleRange(mainText.length(), subTextFinal.length(), blue, null);
		styles.add(styleSubText);
	}
	cell.setStyleRanges(styles.toArray(new StyleRange[0]));
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:24,代码来源:KspOutlinePage.java

示例5: appendToDetail

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
/**
 * Appends the given message to the detail panel; render the message in error color if specified
 * @param value
 * @param isError if <code>true</code> then render the message in the system error color; otherwise render in default color
 */
private void appendToDetail(String value, boolean isError) {

	if (null == value || value.length() < 1) {
		return;
	}

	if (null == detailListWidget || detailListWidget.isDisposed()) {
		return;
	}

	int charCount = detailListWidget.getCharCount();
	detailListWidget.append(value + "\n");
	if (isError) {
		StyleRange style2 = new StyleRange();
		style2.start = charCount;
		style2.length = value.length();
		style2.foreground = errorColor;
		detailListWidget.setStyleRange(style2);
	}
	detailSection.setEnabled(true);
	if ( isError ){
		detailSection.setCollapsed( false );
		detailListWidget.setSelection( detailListWidget.getCharCount(), detailListWidget.getCharCount());
	}
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:31,代码来源:ProgressReporterPanel.java

示例6: update

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
@Override
  public void update(ViewerCell cell) {

      AvroNode node = nodeConverter.convertToAvroNode(cell.getElement());
      
String text = labelProvider.getText(node);
      Image image = labelProvider.getImage(node);
      StyleRange[] styleRanges = labelProvider.getStyleRanges(node);

      cell.setText(text);
cell.setImage(image);
      cell.setStyleRanges(styleRanges);

      Color backgroundColor = labelProvider.getBackgroundColor(node);
      if (backgroundColor != null) {
      	cell.setBackground(backgroundColor);
      }
      
      super.update(cell);
  }
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:21,代码来源:SchemaViewerStyledCellLabelProvider.java

示例7: parseByIndex

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
private void parseByIndex(LineStyleEvent event, StyleRange startStyle, String currentText, List<StyleRange> ranges,
		ParseData data) {
	int fromIndex = 0;
	int pos = 0;
	int length = currentText.length();
	do {
		if (fromIndex >= length) {
			break;
		}
		pos = currentText.indexOf(data.subString, fromIndex);
		fromIndex = pos + 1;

		if (pos != -1) {
			addRange(ranges, event.lineOffset + pos, data.subString.length(), getColor(data.color), data.bold);
		}
	} while (pos != -1);
}
 
开发者ID:de-jcup,项目名称:egradle,代码行数:18,代码来源:EGradleConsoleStyleListener.java

示例8: setBracketHighlighting

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
private void setBracketHighlighting(IDocument document) {
	StyleRange styleRange = null;
	Position[] positions = positionHelper.getPositions(document, de.darwinspl.preferences.resource.dwprofile.ui.DwprofilePositionCategory.BRACKET.toString());
	
	for (Position position : positions) {
		Position tmpPosition = convertToWidgetPosition(position);
		if (tmpPosition != null) {
			styleRange = getStyleRangeAtPosition(tmpPosition);
			styleRange.borderStyle = SWT.BORDER_SOLID;
			styleRange.borderColor = bracketColor;
			if (styleRange.foreground == null) {
				styleRange.foreground = black;
			}
			textWidget.setStyleRange(styleRange);
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:18,代码来源:DwprofileHighlighting.java

示例9: removeHighlightingCategory

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
private void removeHighlightingCategory(IDocument document, String category) {
	Position[] positions = positionHelper.getPositions(document, category);
	if (category.equals(de.darwinspl.preferences.resource.dwprofile.ui.DwprofilePositionCategory.BRACKET.toString())) {
		StyleRange styleRange;
		for (Position position : positions) {
			Position tmpPosition = convertToWidgetPosition(position);
			if (tmpPosition != null) {
				styleRange = getStyleRangeAtPosition(tmpPosition);
				styleRange.borderStyle = SWT.NONE;
				styleRange.borderColor = null;
				styleRange.background = null;
				textWidget.setStyleRange(styleRange);
			}
		}
	}
	positionHelper.removePositions(document, category);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:18,代码来源:DwprofileHighlighting.java

示例10: setBracketHighlighting

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
private void setBracketHighlighting(IDocument document) {
	StyleRange styleRange = null;
	Position[] positions = positionHelper.getPositions(document, eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionPositionCategory.BRACKET.toString());
	
	for (Position position : positions) {
		Position tmpPosition = convertToWidgetPosition(position);
		if (tmpPosition != null) {
			styleRange = getStyleRangeAtPosition(tmpPosition);
			styleRange.borderStyle = SWT.BORDER_SOLID;
			styleRange.borderColor = bracketColor;
			if (styleRange.foreground == null) {
				styleRange.foreground = black;
			}
			textWidget.setStyleRange(styleRange);
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:18,代码来源:HyexpressionHighlighting.java

示例11: removeHighlightingCategory

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
private void removeHighlightingCategory(IDocument document, String category) {
	Position[] positions = positionHelper.getPositions(document, category);
	if (category.equals(eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionPositionCategory.BRACKET.toString())) {
		StyleRange styleRange;
		for (Position position : positions) {
			Position tmpPosition = convertToWidgetPosition(position);
			if (tmpPosition != null) {
				styleRange = getStyleRangeAtPosition(tmpPosition);
				styleRange.borderStyle = SWT.NONE;
				styleRange.borderColor = null;
				styleRange.background = null;
				textWidget.setStyleRange(styleRange);
			}
		}
	}
	positionHelper.removePositions(document, category);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:18,代码来源:HyexpressionHighlighting.java

示例12: setBracketHighlighting

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
private void setBracketHighlighting(IDocument document) {
	StyleRange styleRange = null;
	Position[] positions = positionHelper.getPositions(document, eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaPositionCategory.BRACKET.toString());
	
	for (Position position : positions) {
		Position tmpPosition = convertToWidgetPosition(position);
		if (tmpPosition != null) {
			styleRange = getStyleRangeAtPosition(tmpPosition);
			styleRange.borderStyle = SWT.BORDER_SOLID;
			styleRange.borderColor = bracketColor;
			if (styleRange.foreground == null) {
				styleRange.foreground = black;
			}
			textWidget.setStyleRange(styleRange);
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:18,代码来源:HyvalidityformulaHighlighting.java

示例13: removeHighlightingCategory

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
private void removeHighlightingCategory(IDocument document, String category) {
	Position[] positions = positionHelper.getPositions(document, category);
	if (category.equals(eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaPositionCategory.BRACKET.toString())) {
		StyleRange styleRange;
		for (Position position : positions) {
			Position tmpPosition = convertToWidgetPosition(position);
			if (tmpPosition != null) {
				styleRange = getStyleRangeAtPosition(tmpPosition);
				styleRange.borderStyle = SWT.NONE;
				styleRange.borderColor = null;
				styleRange.background = null;
				textWidget.setStyleRange(styleRange);
			}
		}
	}
	positionHelper.removePositions(document, category);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:18,代码来源:HyvalidityformulaHighlighting.java

示例14: setBracketHighlighting

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
private void setBracketHighlighting(IDocument document) {
	StyleRange styleRange = null;
	Position[] positions = positionHelper.getPositions(document, eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavaluePositionCategory.BRACKET.toString());
	
	for (Position position : positions) {
		Position tmpPosition = convertToWidgetPosition(position);
		if (tmpPosition != null) {
			styleRange = getStyleRangeAtPosition(tmpPosition);
			styleRange.borderStyle = SWT.BORDER_SOLID;
			styleRange.borderColor = bracketColor;
			if (styleRange.foreground == null) {
				styleRange.foreground = black;
			}
			textWidget.setStyleRange(styleRange);
		}
	}
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:18,代码来源:HydatavalueHighlighting.java

示例15: removeHighlightingCategory

import org.eclipse.swt.custom.StyleRange; //导入依赖的package包/类
private void removeHighlightingCategory(IDocument document, String category) {
	Position[] positions = positionHelper.getPositions(document, category);
	if (category.equals(eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavaluePositionCategory.BRACKET.toString())) {
		StyleRange styleRange;
		for (Position position : positions) {
			Position tmpPosition = convertToWidgetPosition(position);
			if (tmpPosition != null) {
				styleRange = getStyleRangeAtPosition(tmpPosition);
				styleRange.borderStyle = SWT.NONE;
				styleRange.borderColor = null;
				styleRange.background = null;
				textWidget.setStyleRange(styleRange);
			}
		}
	}
	positionHelper.removePositions(document, category);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:18,代码来源:HydatavalueHighlighting.java


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