当前位置: 首页>>代码示例>>Java>>正文


Java StyledText.addModifyListener方法代码示例

本文整理汇总了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();
}
 
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:38,代码来源:CodeLensDemo.java

示例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);
		}
	});
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:35,代码来源:RunComponentWidget.java

示例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();
}
 
开发者ID:technology16,项目名称:pgsqlblocks,代码行数:32,代码来源:UIAppender.java

示例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);
		}
	});
	

}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:52,代码来源:RunSQLQueryWidget.java


注:本文中的org.eclipse.swt.custom.StyledText.addModifyListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。