本文整理汇总了Java中org.eclipse.swt.custom.StyledText.addModifyListener方法的典型用法代码示例。如果您正苦于以下问题:Java StyledText.addModifyListener方法的具体用法?Java StyledText.addModifyListener怎么用?Java StyledText.addModifyListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.custom.StyledText
的用法示例。
在下文中一共展示了StyledText.addModifyListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
// create the widget's shell
Shell shell = new Shell();
shell.setLayout(new FillLayout());
shell.setSize(500, 500);
Display display = shell.getDisplay();
Composite parent = new Composite(shell, SWT.NONE);
parent.setLayout(new GridLayout(2, false));
ITextViewer textViewer = new TextViewer(parent, SWT.V_SCROLL | SWT.BORDER);
String delim = textViewer.getTextWidget().getLineDelimiter();
textViewer.setDocument(new Document(delim + " class A" + delim + "new A" + delim + "new A" + delim + "class B"
+ delim + "new B" + delim + "interface I" + delim + "class C implements I"));
StyledText styledText = textViewer.getTextWidget();
styledText.setLayoutData(new GridData(GridData.FILL_BOTH));
CodeLensProviderRegistry registry = CodeLensProviderRegistry.getInstance();
registry.register(CONTENT_TYPE_ID, new ClassReferencesCodeLensProvider());
registry.register(CONTENT_TYPE_ID, new ClassImplementationsCodeLensProvider());
CodeLensStrategy codelens = new CodeLensStrategy(new DefaultCodeLensContext(textViewer), false);
codelens.addTarget(CONTENT_TYPE_ID).reconcile(null);
styledText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent event) {
codelens.reconcile(null);
}
});
shell.open();
while (!shell.isDisposed())
if (!display.readAndDispatch())
display.sleep();
}
示例2: attachToPropertySubGroup
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
@Override
public void attachToPropertySubGroup(AbstractELTContainerWidget container) {
ELTDefaultSubgroupComposite defaultSubgroupComposite = new ELTDefaultSubgroupComposite(
container.getContainerControl());
defaultSubgroupComposite.createContainerWidget();
AbstractELTWidget eltDefaultLable = new ELTDefaultLable(Messages.EXECUTION_COMMAND);
defaultSubgroupComposite.attachWidget(eltDefaultLable);
styledText=new StyledText(defaultSubgroupComposite.getContainerControl(), SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
GridData gridData=new GridData(SWT.FILL, SWT.FILL, true, true);
gridData.heightHint=80;
styledText.setLayoutData(gridData);
txtDecorator = WidgetUtility.addDecorator(styledText, Messages.bind(Messages.EMPTY_FIELD, Messages.EXECUTION_COMMAND));
ListenerHelper helper = new ListenerHelper();
helper.put(HelperType.CONTROL_DECORATION, txtDecorator);
populateWidget();
styledText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
if(StringUtils.isNotBlank(styledText.getText())){
txtDecorator.hide();
}else{
txtDecorator.show();
}
showHideErrorSymbol(widgets);
propertyDialogButtonBar.enableApplyButton(true);
}
});
}
示例3: createControl
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
private void createControl() {
GridLayout layout = new GridLayout();
layout.marginTop = 0;
text = new StyledText(parent, SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
text.setLayout(layout);
text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
text.setMargins(3, 3, 3, 3);
text.layout(true);
text.addModifyListener(modifyListener);
parent.layout(true, true);
// add empty string on ENTER pressed
text.addTraverseListener(e -> {
switch (e.detail) {
case SWT.TRAVERSE_RETURN:
if (!text.isDisposed()) {
text.append("\n");
text.setTopIndex(text.getLineCount() - 1);
text.setCaretOffset(text.getCharCount() - 1);
}
break;
default:
break;
}
});
// wheel up and down
text.addMouseWheelListener(e -> autoScrollEnabled = e.count <= 0);
styledTextContent = text.getContent();
}
示例4: attachToPropertySubGroup
import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
@Override
public void attachToPropertySubGroup(AbstractELTContainerWidget container) {
ELTDefaultSubgroupComposite defaultSubgroupComposite = new ELTDefaultSubgroupComposite(
container.getContainerControl());
defaultSubgroupComposite.createContainerWidget();
AbstractELTWidget eltDefaultLable = new ELTDefaultLable(Messages.RUN_SQL_QUERY);
defaultSubgroupComposite.attachWidget(eltDefaultLable);
styledText=new StyledText(defaultSubgroupComposite.getContainerControl(), SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
GridData gridData=new GridData(SWT.FILL, SWT.FILL, true, true);
gridData.heightHint=80;
gridData.widthHint = 120;
styledText.setLayoutData(gridData);
txtDecorator = WidgetUtility.addDecorator(styledText, Messages.bind(Messages.EMPTY_FIELD, Messages.EXECUTION_COMMAND));
AbstractELTWidget eltDefaultButton = new ELTDefaultButton("");
defaultSubgroupComposite.attachWidget(eltDefaultButton);
((Button) eltDefaultButton.getSWTWidgetControl()).setVisible(false);
AbstractELTWidget label = new ELTDefaultLable("");
defaultSubgroupComposite.attachWidget(label);
((Label) label.getSWTWidgetControl()).setVisible(false);
AbstractELTWidget textLabel = new ELTDefaultLable(Messages.RUN_SQL_MESSAGE);
defaultSubgroupComposite.attachWidget(textLabel);
((Label) textLabel.getSWTWidgetControl()).setLayoutData(new GridData(0, 0, true, false));
ListenerHelper helper = new ListenerHelper();
helper.put(HelperType.CONTROL_DECORATION, txtDecorator);
Utils.INSTANCE.loadProperties();
cursor = container.getContainerControl().getDisplay().getSystemCursor(SWT.CURSOR_HAND);
populateWidget();
styledText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
if(StringUtils.isNotBlank(styledText.getText())){
txtDecorator.hide();
}else{
txtDecorator.show();
}
showHideErrorSymbol(widgets);
propertyDialogButtonBar.enableApplyButton(true);
}
});
}