本文整理匯總了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);
}