本文整理汇总了Java中org.eclipse.swt.custom.StyledText.addKeyListener方法的典型用法代码示例。如果您正苦于以下问题:Java StyledText.addKeyListener方法的具体用法?Java StyledText.addKeyListener怎么用?Java StyledText.addKeyListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.custom.StyledText
的用法示例。
在下文中一共展示了StyledText.addKeyListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPartControl
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
Control adapter = getAdapter(Control.class);
if (adapter instanceof StyledText) {
StyledText text = (StyledText) adapter;
text.addCaretListener(new BatchEditorCaretListener());
}
activateBatchEditorContext();
installAdditionalSourceViewerSupport();
StyledText styledText = getSourceViewer().getTextWidget();
styledText.addKeyListener(new BatchBracketInsertionCompleter(this));
/*
* register as resource change listener to provide marker change
* listening
*/
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
setTitleImageInitial();
}
示例2: createPartControl
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
Control adapter = getAdapter(Control.class);
if (adapter instanceof StyledText) {
StyledText text = (StyledText) adapter;
text.addCaretListener(new BashEditorCaretListener());
}
activateBashEditorContext();
installAdditionalSourceViewerSupport();
StyledText styledText = getSourceViewer().getTextWidget();
styledText.addKeyListener(new BashBracketInsertionCompleter(this));
/*
* register as resource change listener to provide marker change
* listening
*/
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
setTitleImageInitial();
}
示例3: newTextArea
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
public StyledText newTextArea(Composite composite, boolean editable, int sty) {
int style = SWT.MULTI | SWT.V_SCROLL;
if (!editable)
style |= SWT.READ_ONLY;
else
style |= SWT.WRAP;
StyledText d = new StyledText(composite, style);
d.setText("To be entered\ntest\n\test\ntest");
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.heightHint = 80;
gd.widthHint = 460;
gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
d.setEditable(editable);
d.setLayoutData(gd);
d.setFont(FontShop.textFont());
if (keyListener != null)
d.addKeyListener(keyListener);
d.setWordWrap(editable);
WidgetShop.tweakTextWidget(d);
return d;
}
示例4: TextAreaParameter
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
public
TextAreaParameter(
Composite composite,
UITextAreaImpl _ui_text_area)
{
super( "" );
ui_text_area = _ui_text_area;
text_area = new StyledText(composite,SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
ClipboardCopy.addCopyToClipMenu(
text_area,
new ClipboardCopy.copyToClipProvider()
{
@Override
public String
getText()
{
return( text_area.getText().trim());
}
});
text_area.addKeyListener(
new KeyAdapter()
{
@Override
public void
keyPressed(
KeyEvent event )
{
int key = event.character;
if ( key <= 26 && key > 0 ){
key += 'a' - 1;
}
if ( key == 'a' && event.stateMask == SWT.MOD1 ){
event.doit = false;
text_area.selectAll();
}
}
});
text_area.setText(ui_text_area.getText());
ui_text_area.addPropertyChangeListener(this);
}