Java 类org.eclipse.swt.widgets.IME 实例源码

项目:translationstudio8    文件:StyledTextCellEditor.java   
/**
 * 初始化默认颜色、字体等
 * @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));

}
项目:tmxeditor8    文件:CellEditor.java   
@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;
}
项目:tmxeditor8    文件:StyledTextCellEditor.java   
/**
 * 初始化默认颜色、字体等
 * @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));

}
项目:JXTN    文件:FXCanvas2.java   
@SuppressWarnings("deprecation")
public FXCanvas2(Composite parent, int style)
{
    super(parent, style);
    if (System.getProperty("os.name").toLowerCase().contains("win"))
    {
        this.ime = new IME(this, SWT.NONE);
        this.ime.addListener(SWT.ImeComposition, new org.eclipse.swt.widgets.Listener()
            {
                @Override
                public void handleEvent(org.eclipse.swt.widgets.Event event)
                {
                    switch (event.detail)
                    {
                    case SWT.COMPOSITION_CHANGED:
                        FXCanvas2.this.sendInputMethodEventToFX();
                        break;
                    }
                }

            });
    }
    else
    {
        this.ime = null;
    }
}