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