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


Java TextEvent类代码示例

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


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

示例1: getTextListener

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
private ITextListener getTextListener() {
	return new ITextListener() {

		@Override
		public void textChanged(final TextEvent event) {
			if (bookmark == null || !getSourceViewer().isEditable()) {
				return;
			}
			final String newComment = getDocument().get();
			try {
				SetBookmarkCommentOperation operation = new SetBookmarkCommentOperation(bookmarkDatabase);
				operation.setComment(bookmark.getId(), newComment);
			} catch (BookmarksException e) {
				// never happen
			}
		}
	};
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:19,代码来源:BookmarkCommentArea.java

示例2: updateTextListeners

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
/**
 * Informs all registered text listeners about the change specified by the
 * widget command. This method does not use a robust iterator.
 *
 * @param cmd
 *          the widget command translated into a text event sent to all text listeners
 */
@Override
protected void updateTextListeners(final WidgetCommand cmd) {
  List<ITextListener> textListeners = fTextListeners;
  if (textListeners != null) {
    textListeners = new ArrayList<ITextListener>(textListeners);
    DocumentEvent event = cmd.event;
    if (event instanceof SlaveDocumentEvent) {
      event = ((SlaveDocumentEvent) event).getMasterEvent();
    }
    TextEvent e = new TextEvent(cmd.start, cmd.length, cmd.text, cmd.preservedText, event, redraws()) {};
    for (int i = 0; i < textListeners.size(); i++) {
      ITextListener l = textListeners.get(i);
      l.textChanged(e);
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:24,代码来源:FixedXtextSourceViewer.java

示例3: computeChange

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
/**
 * Computes the change abstraction given a text event.
 *
 * @param event the text event to analyze
 * @return a change object describing the event
 */
private Change computeChange(TextEvent event) {
	DocumentEvent e = event.getDocumentEvent();
	if (e == null) return new Change(TypingRun.NO_CHANGE, -1);

	int start = e.getOffset();
	int end = e.getOffset() + e.getLength();
	String newText = e.getText();
	if (newText == null) newText = new String();

	if (start == end) {
		// no replace / delete / overwrite
		if (newText.length() == 1) return new Change(TypingRun.INSERT, end + 1);
	} else if (start == end - 1) {
		if (newText.length() == 1) return new Change(TypingRun.OVERTYPE, end);
		if (newText.length() == 0) return new Change(TypingRun.DELETE, start);
	}

	return new Change(TypingRun.UNKNOWN, -1);
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:26,代码来源:TypingRunDetector.java

示例4: installUndoRedoSupport

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
protected OperationHistoryListener installUndoRedoSupport(SourceViewer viewer, IDocument document, final EmbeddedEditorActions actions) {
			IDocumentUndoManager undoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(document);
			final IUndoContext context = undoManager.getUndoContext();
			
			// XXX cp uncommented
			
//			IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
			OperationHistoryListener operationHistoryListener = new OperationHistoryListener(context, new IUpdate() {
				public void update() {
					actions.updateAction(ITextEditorActionConstants.REDO);
					actions.updateAction(ITextEditorActionConstants.UNDO);
				}
			});
			viewer.addTextListener(new ITextListener() {
				
				public void textChanged(TextEvent event) {
					actions.updateAction(ITextEditorActionConstants.REDO);
					actions.updateAction(ITextEditorActionConstants.UNDO);
					
				}
			});
//			
//			operationHistory.addOperationHistoryListener(operationHistoryListener);
			return operationHistoryListener;
		}
 
开发者ID:cplutte,项目名称:bts,代码行数:26,代码来源:EmbeddedEditorFactory.java

示例5: createPartControl

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
/**
 * When the editor is graphically created then add a text change listener
 * to the viewer
 */
@Override
public void createPartControl(Composite parent) {
	super.createPartControl(parent);
	getSourceViewer().addTextListener(new ITextListener() {
		
		@Override
		public void textChanged(TextEvent event) {
			if (outlinePage != null) {
				String text = getSourceViewer().getTextWidget().getText();
				try{
					outlinePage.setInput(text);
				}catch(Exception ex){
					
				}
			}
		}
	});
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:23,代码来源:XMLEditor.java

示例6: textChanged

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
public void textChanged(TextEvent event) {

			fCachedRedrawState= event.getViewerRedrawState();
			if (!fCachedRedrawState)
				return;

			if (updateNumberOfDigits()) {
				computeIndentations();
				layout(event.getViewerRedrawState());
				return;
			}

			boolean viewerCompletelyShown= isViewerEntirelyShown();
			if (viewerCompletelyShown || fSensitiveToTextChanges || event.getDocumentEvent() == null)
				doPostRedraw();
			fSensitiveToTextChanges= viewerCompletelyShown;
		}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:18,代码来源:CommonLineNumberRulerColumn.java

示例7: computeChange

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
/**
 * Computes the change abstraction given a text event.
 *
 * @param event the text event to analyze
 * @return a change object describing the event
 */
private Change computeChange(TextEvent event) {
	DocumentEvent e= event.getDocumentEvent();
	if (e == null)
		return new Change(TypingRun.NO_CHANGE, -1);

	int start= e.getOffset();
	int end= e.getOffset() + e.getLength();
	String newText= e.getText();
	if (newText == null)
		newText= new String();

	if (start == end) {
		// no replace / delete / overwrite
		if (newText.length() == 1)
			return new Change(TypingRun.INSERT, end + 1);
	} else if (start == end - 1) {
		if (newText.length() == 1)
			return new Change(TypingRun.OVERTYPE, end);
		if (newText.length() == 0)
			return new Change(TypingRun.DELETE, start);
	}

	return new Change(TypingRun.UNKNOWN, -1);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:31,代码来源:TypingRunDetector.java

示例8: configureSourceViewer

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
private void configureSourceViewer(SourceViewer viewer) {
	viewer.setEditable(false);

	viewer.addTextListener(new ITextListener() {
		@Override
		public void textChanged(TextEvent event) {
			updateHighlighting();
			sourceViewer.getTextWidget().setFont(editorFont);
		}
	});

}
 
开发者ID:eclipse,项目名称:n4js,代码行数:13,代码来源:WizardPreviewProvider.java

示例9: widgetRegion2ModelRegion

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
/**
 * Translates the given text event into the corresponding range of the viewer's
 * document.
 * 
 * @param e
 *            the text event
 * @return the widget region corresponding the region of the given event or
 *         <code>null</code> if none
 * @since 2.1
 */
private IRegion widgetRegion2ModelRegion(TextEvent e) {

	String text = e.getText();
	int length = text == null ? 0 : text.length();

	if (viewer instanceof ITextViewerExtension5) {
		ITextViewerExtension5 extension = (ITextViewerExtension5) viewer;
		return extension.widgetRange2ModelRange(new Region(e.getOffset(), length));
	}

	IRegion visible = viewer.getVisibleRegion();
	IRegion region = new Region(e.getOffset() + visible.getOffset(), length);
	return region;
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:25,代码来源:TMPresentationReconciler.java

示例10: textChanged

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
@Override
public void textChanged(TextEvent event) {
	if (event.getDocumentEvent() != null) {
		return;
	}

	String command = "viewer.invalidateTextPresentation(" + event.getOffset() + ", " + event.getLength() + ");";
	write("\t\t" + command, true);

	//commands.add(new Command(command));

}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:13,代码来源:TMPresentationReconcilerTestGenerator.java

示例11: textChanged

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
@Override
public void textChanged(TextEvent event) {
	if (!event.getViewerRedrawState())
		return;
	updatePopupLocation(false);
	updateVisibility(); //only for hiding outside editor area
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:8,代码来源:RenameInformationPopup.java

示例12: textChanged

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
@Override
public void textChanged(TextEvent e) {
    if (fTextViewer != null && e.getDocumentEvent() == null && e.getViewerRedrawState()) {
        // handle only changes of visible document
        redraw();
    }
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:8,代码来源:CopiedOverviewRuler.java

示例13: textChanged

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
@Override
public void textChanged(TextEvent e) {
	if (!e.getViewerRedrawState()) {
		return;
	}
	// changed text: propagate previous style, which will be overridden
	// later asynchronously by TM
	if (e.getDocumentEvent() != null) {
		int diff = e.getText().length() - e.getLength();
		if (diff > 0 && e.getOffset() > 0) {
			StyleRange range = viewer.getTextWidget().getStyleRangeAtOffset(e.getOffset() - 1);
			if (range != null) {
				range.length += diff;
				viewer.getTextWidget().setStyleRange(range);
			}
		}
	} else { // TextViewer#invalidateTextPresentation is called (because
				// of validation, folding, etc)
		// case 2), do the colorization.
		IDocument document = viewer.getDocument();
		if (document != null) {
			IRegion region = null;
			int fromLineNumber = -1;
			int toLineNumber = -1;
			if (e.getOffset() == 0 && e.getLength() == 0 && e.getText() == null) {
				// redraw state change, damage the whole document
				fromLineNumber = 0;
				toLineNumber = document.getNumberOfLines() - 1;
			} else {
				region = widgetRegion2ModelRegion(e);
				if (region != null) {
					if (region.getLength() == 0) {
						// Some text was removed, don't colorize it.
						return;
					}
					try {
						String text = document.get(region.getOffset(), region.getLength());
						DocumentEvent de = new DocumentEvent(document, region.getOffset(), region.getLength(),
								text);
						fromLineNumber = DocumentHelper.getStartLine(de);
						toLineNumber = DocumentHelper.getEndLine(de, false);
					} catch (BadLocationException x) {
					}
				}
			}
			if (enabled) {
				// case where there is grammar & theme -> update text presentation with the
				// grammar tokens
				ITMModel model = getTMModelManager().connect(document);
				colorize(fromLineNumber, toLineNumber, region, (TMDocumentModel) model);
			} else {
				if (region != null) {
					// case where there is no grammar & theme -> update text presentation with the
					// default styles (ex: to support highlighting with GenericEditor)
					TextPresentation presentation = new TextPresentation(region, 100);
					presentation.setDefaultStyleRange(
							new StyleRange(region.getOffset(), region.getLength(), null, null));
					applyTextRegionCollection(presentation);
				}
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:64,代码来源:TMPresentationReconciler.java

示例14: textChanged

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
public void textChanged(TextEvent e){
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:3,代码来源:SootResourceManager.java

示例15: textChanged

import org.eclipse.jface.text.TextEvent; //导入依赖的package包/类
public void textChanged(TextEvent event)
{
    perform();
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:5,代码来源:DirtyMarkingListener.java


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