Java Code Examples for org.eclipse.swt.custom.StyledText#setIME()

The following examples show how to use org.eclipse.swt.custom.StyledText#setIME() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StyledTextCellEditor.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 初始化默认颜色、字体等
 * @param textControl
 *            ;
 */
private void initStyle(final StyledText textControl, IStyle cellStyle) {
	// textControl.setBackground(cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR));
	textControl.setBackground(GUIHelper.getColor(210, 210, 240));
	textControl.setForeground(cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR));

	textControl.setLineSpacing(Constants.SEGMENT_LINE_SPACING);
	textControl.setLeftMargin(Constants.SEGMENT_LEFT_MARGIN);
	textControl.setRightMargin(Constants.SEGMENT_RIGHT_MARGIN);
	textControl.setTopMargin(Constants.SEGMENT_TOP_MARGIN);
	textControl.setBottomMargin(Constants.SEGMENT_TOP_MARGIN);

	// textControl.setLeftMargin(0);
	// textControl.setRightMargin(0);
	// textControl.setTopMargin(0);
	// textControl.setBottomMargin(0);

	textControl.setFont(JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.XLIFF_EDITOR_TEXT_FONT));
	textControl.setIME(new IME(textControl, SWT.NONE));

}
 
Example 2
Source File: CellEditor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Control activateCell(Composite parent, Object originalCanonicalValue, Character initialEditValue) {
	if (originalCanonicalValue == null || !(originalCanonicalValue instanceof CellEditorCanonicalValue)) {
		return null;
	}

	StyledText textControl = createTextControl(parent);
	// init style
	IStyle cellStyle = getCellStyle();

	textControl.setBackground(GUIHelper.getColor(210, 210, 240));
	textControl.setForeground(cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR));
	//textControl.setFont(cellStyle.getAttributeValue(CellStyleAttributes.FONT));
	textControl.setLineSpacing(TmxEditorConstanst.SEGMENT_LINE_SPACING);
	textControl.setLeftMargin(TmxEditorConstanst.SEGMENT_LEFT_MARGIN);
	textControl.setRightMargin(TmxEditorConstanst.SEGMENT_RIGHT_MARGIN);
	textControl.setTopMargin(TmxEditorConstanst.SEGMENT_TOP_MARGIN);
	textControl.setBottomMargin(TmxEditorConstanst.SEGMENT_TOP_MARGIN);
	textControl.setIME(new IME(textControl, SWT.NONE));

	setCanonicalValue(originalCanonicalValue);
	textControl.forceFocus();
	return textControl;
}
 
Example 3
Source File: StyledTextCellEditor.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 初始化默认颜色、字体等
 * @param textControl
 *            ;
 */
private void initStyle(final StyledText textControl, IStyle cellStyle) {
	// textControl.setBackground(cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR));
	textControl.setBackground(GUIHelper.getColor(210, 210, 240));
	textControl.setForeground(cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR));

	textControl.setLineSpacing(Constants.SEGMENT_LINE_SPACING);
	textControl.setLeftMargin(Constants.SEGMENT_LEFT_MARGIN);
	textControl.setRightMargin(Constants.SEGMENT_RIGHT_MARGIN);
	textControl.setTopMargin(Constants.SEGMENT_TOP_MARGIN);
	textControl.setBottomMargin(Constants.SEGMENT_TOP_MARGIN);

	// textControl.setLeftMargin(0);
	// textControl.setRightMargin(0);
	// textControl.setTopMargin(0);
	// textControl.setBottomMargin(0);

	textControl.setFont(JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.XLIFF_EDITOR_TEXT_FONT));
	textControl.setIME(new IME(textControl, SWT.NONE));

}