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


Java ExtendedModifyListener类代码示例

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


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

示例1: undoManager

import org.eclipse.swt.custom.ExtendedModifyListener; //导入依赖的package包/类
public undoManager(StyledText text,int level){
		if(text != null) {
			this.text = text;
			text.addExtendedModifyListener(new ExtendedModifyListener() {
				
				@Override
				public void modifyText(ExtendedModifyEvent event) {
					// TODO Auto-generated method stub
//					if(event.st)
				}
			});
		}
		this.level = level;
	}
 
开发者ID:piiiiq,项目名称:Black,代码行数:15,代码来源:undoManager.java

示例2: addModifyListener

import org.eclipse.swt.custom.ExtendedModifyListener; //导入依赖的package包/类
public void addModifyListener(final StyledText st) {
	st.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent e) {
			// TODO Auto-generated method stub
			black.ba.setFileChanged();
		}
	});

	// Ϊ��������ַ�������ʽ
	st.addExtendedModifyListener(new ExtendedModifyListener() {

		public void modifyText(ExtendedModifyEvent event) {

			if (!st.isDisposed()) {
				if (event.start > 0 && event.start <= st.getCharCount()) {
					int alignment = st.getLineAlignment(st.getLineAtOffset(event.start - 1));
					st.setLineAlignment(st.getLineAtOffset(event.start), 1, alignment);

					StyleRange s = st.getStyleRangeAtOffset(event.start - 1);
					if (s != null && s.start + s.length < st.getCharCount()) {
						s.start = event.start;
						s.length = 1;

						st.setStyleRange(s);
					}
				}
				if (event.start + event.length == st.getCharCount() && defaultStyle != null) {
					StyleRange sr = new StyleRange(defaultStyle);
					sr.start = event.start;
					sr.length = event.length;
					st.setStyleRange(sr);
					defaultStyle = null;
				}
			}
		}
	});
}
 
开发者ID:piiiiq,项目名称:Black,代码行数:40,代码来源:blackTextArea.java

示例3: ScriptConsoleStyledText

import org.eclipse.swt.custom.ExtendedModifyListener; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param parent parent for the styled text
 * @param style style to be used
 */
public ScriptConsoleStyledText(Composite parent, int style) {
    super(parent, style);

    /**
     * The StyledText will change the caretOffset that we've updated during the modifications,
     * so, the verify and the extended modify listener will keep track if it actually does
     * that and will reset the caret to the position we actually added it.
     *
     * Feels like a hack but I couldn't find a better way to do it.
     */
    addVerifyListener(new VerifyListener() {

        @Override
        public void verifyText(VerifyEvent e) {
            internalCaretSet = -1;
        }
    });

    /**
     * Set it to the location we've set it to be.
     */
    addExtendedModifyListener(new ExtendedModifyListener() {

        @Override
        public void modifyText(ExtendedModifyEvent event) {
            if (internalCaretSet != -1) {
                if (internalCaretSet != getCaretOffset()) {
                    setCaretOffset(internalCaretSet);
                }
                internalCaretSet = -1;
            }
        }
    });

    initDragDrop();

    handleDeletePreviousWord = new HandleDeletePreviousWord();
    handleLineStartAction = new HandleLineStartAction();
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:46,代码来源:ScriptConsoleViewer.java

示例4: main

import org.eclipse.swt.custom.ExtendedModifyListener; //导入依赖的package包/类
public static void main(String[] args) {
    final Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    final StyledText styledText = new StyledText(shell, SWT.WRAP | SWT.BORDER |SWT.MULTI );
    styledText.setText(text);
    FontData data = display.getSystemFont().getFontData()[0];
    Font font = new Font(display, data.getName(), 16, SWT.BOLD);
    styledText.setFont(font);
    styledText.setForeground(display.getSystemColor(SWT.COLOR_BLUE));
    
    
//    styledText.setOrientation(SWT.RIGHT_TO_LEFT);
//	text.setTextDirection(SWT.RIGHT_TO_LEFT);
    
    styledText.setAlignment(SWT.RIGHT);
    
    styledText.addExtendedModifyListener(new ExtendedModifyListener() {
		@Override public void modifyText(ExtendedModifyEvent event) {
			styledText.setCaretOffset(event.start);
		}
	});    
    
//    styledText.addListener(SWT.Resize, new Listener() {
//      public void handleEvent(Event event) {
//        Rectangle rect = styledText.getClientArea();
//        Image newImage = new Image(display, 1, Math.max(1, rect.height));
//        GC gc = new GC(newImage);
//        gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
//        gc.setBackground(display.getSystemColor(SWT.COLOR_YELLOW));
//        gc.fillGradientRectangle(rect.x, rect.y, 1, rect.height, true);
//        gc.dispose();
//        styledText.setBackgroundImage(newImage);
//        if (oldImage != null)
//          oldImage.dispose();
//        oldImage = newImage;
//      }
//    });
    shell.setSize(700, 400);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    if (oldImage != null)
      oldImage.dispose();
    font.dispose();
    display.dispose();
  }
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:50,代码来源:StyledTextGradientBackground.java

示例5: addUserExtendedModifyListener

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


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