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


Java LineStyleListener类代码示例

本文整理汇总了Java中org.eclipse.swt.custom.LineStyleListener的典型用法代码示例。如果您正苦于以下问题:Java LineStyleListener类的具体用法?Java LineStyleListener怎么用?Java LineStyleListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LineStyleListener类属于org.eclipse.swt.custom包,在下文中一共展示了LineStyleListener类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LineEditor

import org.eclipse.swt.custom.LineStyleListener; //导入依赖的package包/类
public LineEditor(final SWTCanvas canvas, int style) {
		super(canvas, style, TrpTextLineType.class);
		
		textField = new StyledText(SWTUtil.dummyShell, SWT.SINGLE | SWT.BORDER);
		textField.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		// this one highlights words that are tagged:
		textField.addLineStyleListener(new LineStyleListener() {
			@Override
			public void lineGetStyle(LineStyleEvent event) {				
				if (shape==null)
					return;
				
//				List<StyleRange> styleList = ATranscriptionWidget.getTagStylesForLine(shape, event.lineOffset);
//				event.styles = (StyleRange[]) ArrayUtils.addAll(event.styles, styleList.toArray(new StyleRange[0]));
			}
		});
		addWidget(textField);

		// autocomplete field:
		autocomplete = new TrpAutoCompleteField(textField, 
				new StyledTextContentAdapter(textField), new String[]{}, 
				KeyStroke.getInstance(SWT.CTRL, SWT.SPACE), null
				);
		autocomplete.getAdapter().setEnabled(false);
	}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:26,代码来源:LineEditor.java

示例2: show

import org.eclipse.swt.custom.LineStyleListener; //导入依赖的package包/类
public void show(String title, final String message, LineStyleListener listener) {
	initLayout();
	dialog.setText(title);
	text.setText(message);
	if (listener != null) {
		text.addLineStyleListener(listener);
	}
	dialog.pack();
	dialog.open();
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:11,代码来源:EditableMessageDialog.java

示例3: applyStyledFormat

import org.eclipse.swt.custom.LineStyleListener; //导入依赖的package包/类
public static void applyStyledFormat(StyledText text, String sql) {
	if (StringUtil.isEmpty(sql)) return;
	text.setText(sql);
	text.addLineStyleListener(new LineStyleListener() {
		public void lineGetStyle(LineStyleEvent event) {
			String line = event.lineText;
			LinkedList<StyleRange> list = new LinkedList<StyleRange>();
			line = line.toLowerCase();
			String[] tokens = StringUtil.tokenizer(line, " \n\r\f\t()+*/-=<>'`\"[],");
			if (tokens == null) return;
			HashSet<String> set = new HashSet<String>();
			for (int i = 0; i < tokens.length; i++) {
				set.add(tokens[i]);
			}
			for (int i = 0; i < key.length; i++) {
				if (set.contains(key[i])) {
					int cursor = -1;
					while ((cursor = line.indexOf(key[i], cursor + 1)) > -1) {
						StyleRange sr = new StyleRange();
						sr.start = event.lineOffset + cursor;
						sr.length = key[i].length();
						sr.foreground = Display.getCurrent().getSystemColor(SWT.COLOR_BLUE);
						list.add(sr);
					}
				}
			}
			event.styles = list.toArray(new StyleRange[list.size()]);
		}
	});
}
 
开发者ID:scouter-project,项目名称:scouter,代码行数:31,代码来源:SqlFormatUtil.java

示例4: SearchStyleText

import org.eclipse.swt.custom.LineStyleListener; //导入依赖的package包/类
public SearchStyleText() {
  shell.setLayout(new GridLayout(2, false));
  
  styledText = new StyledText(shell, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
  GridData gridData = new GridData(GridData.FILL_BOTH);
  gridData.horizontalSpan = 2;    
  styledText.setLayoutData(gridData);
  
  keywordText = new Text(shell, SWT.SINGLE | SWT.BORDER);
  keywordText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  Font font = new Font(shell.getDisplay(), "Courier New", 12, SWT.NORMAL);
  styledText.setFont(font);
  
  button = new Button(shell, SWT.PUSH);
  button.setText("Search");
  button.addSelectionListener(new SelectionAdapter() {
    public void widgetSelected(SelectionEvent e) {
      keyword = keywordText.getText();
      styledText.redraw();
    }
  });
  
  styledText.addLineStyleListener(new LineStyleListener() {
    public void lineGetStyle(LineStyleEvent event) {
      if(keyword == null || keyword.length() == 0) {
        event.styles = new StyleRange[0];
        return;
      }
      
      String line = event.lineText;
      int cursor = -1;
      
      LinkedList list = new LinkedList();
      while( (cursor = line.indexOf(keyword, cursor+1)) >= 0) {
        list.add(getHighlightStyle(event.lineOffset+cursor, keyword.length()));
      }
      
      event.styles = (StyleRange[]) list.toArray(new StyleRange[list.size()]);
    }
  });
  
  keyword = "SW";
  
  styledText.setText("AWT, SWING \r\nSWT & JFACE");
  
  shell.pack();
  shell.open();
  //textUser.forceFocus();

  // Set up the event loop.
  while (!shell.isDisposed()) {
    if (!display.readAndDispatch()) {
      // If no more entries in event queue
      display.sleep();
    }
  }

  display.dispose();
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:60,代码来源:SearchStyleText.java

示例5: addUserLineStyleListener

import org.eclipse.swt.custom.LineStyleListener; //导入依赖的package包/类
public void addUserLineStyleListener(LineStyleListener l) {
	lineStyleListener.add(l);
	text.addLineStyleListener(l);
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:5,代码来源:ATranscriptionWidget.java

示例6: addLineStyleListener

import org.eclipse.swt.custom.LineStyleListener; //导入依赖的package包/类
public void addLineStyleListener(LineStyleListener lineStyler){
	styledText.addLineStyleListener(lineStyler);	
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:4,代码来源:StyledTextComp.java

示例7: addLineStyleListener

import org.eclipse.swt.custom.LineStyleListener; //导入依赖的package包/类
public void addLineStyleListener( LineStyleListener lineStyler ) {
  styledText.addLineStyleListener( lineStyler );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:4,代码来源:StyledTextComp.java


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