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


Java TextConsoleViewer.getTextWidget方法代码示例

本文整理汇总了Java中org.eclipse.ui.console.TextConsoleViewer.getTextWidget方法的典型用法代码示例。如果您正苦于以下问题:Java TextConsoleViewer.getTextWidget方法的具体用法?Java TextConsoleViewer.getTextWidget怎么用?Java TextConsoleViewer.getTextWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.console.TextConsoleViewer的用法示例。


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

示例1: consoleDispatch

import org.eclipse.ui.console.TextConsoleViewer; //导入方法依赖的package包/类
/**
 * Support exchange for simple mark on TextConsole
 * 
 * @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(org.eclipse.ui.console.TextConsoleViewer, org.eclipse.ui.console.IConsoleView, org.eclipse.core.commands.ExecutionEvent)
 */
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
	int mark = viewer.getMark();
	StyledText st = viewer.getTextWidget(); 
	if (mark != -1) {
		try {
			st.setRedraw(false);
			int offset = st.getCaretOffset();
			viewer.setMark(offset);
			st.setCaretOffset(mark);
			int len = offset - mark;
			viewer.setSelectedRange(offset, -len);
		} finally {
			st.setRedraw(true);
		}
	}
	return null;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:23,代码来源:MarkExchangeHandler.java

示例2: consoleDispatch

import org.eclipse.ui.console.TextConsoleViewer; //导入方法依赖的package包/类
/**
 * @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(TextConsoleViewer, IConsoleView, ExecutionEvent)
 */
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
	
	StyledText st = viewer.getTextWidget(); 
	String id = event.getCommand().getId(); 
	boolean isSelect =  isMarkEnabled(viewer,(ITextSelection)viewer.getSelection());
	int action = getDispatchId(id,isSelect);
	if (action > -1) {
		st.invokeAction(action);
	} else if ((id = getId(isSelect)) != null) {
		// support sexps 
		try {
			EmacsPlusUtils.executeCommand(id, null, activePart);
		} catch (Exception e) {
			e.printStackTrace();
		}			
	}
	return null;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:22,代码来源:EmacsMovementHandler.java

示例3: consoleDispatch

import org.eclipse.ui.console.TextConsoleViewer; //导入方法依赖的package包/类
/**
	 * @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(org.eclipse.ui.console.TextConsoleViewer, IConsoleView, ExecutionEvent)
	 */
	public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
		IDocument doc = viewer.getDocument();
		int action = -1;
		try {
			StyledText st = viewer.getTextWidget();
			action = getDispatchId(getId(event, viewer));
			if (action > -1) {
				// set up for kill ring
				doc.addDocumentListener(KillRing.getInstance());
//  			setUpUndo(viewer);
				st.invokeAction(action);
			}
		} finally {
			// remove kill ring behavior
			if (action > -1) {
				doc.removeDocumentListener(KillRing.getInstance());
			}
			KillRing.getInstance().setKill(null, false);
		}
		return null;
	}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:25,代码来源:ConsoleCmdHandler.java

示例4: clearConsoleMark

import org.eclipse.ui.console.TextConsoleViewer; //导入方法依赖的package包/类
/**
 * Support simple clear mark/selection on TextConsole
 *
 * @param viewer
 */
public static void clearConsoleMark(TextConsoleViewer viewer) {
	if (viewer != null) {
		StyledText st = viewer.getTextWidget();
		st.setSelection(st.getCaretOffset());
		viewer.setMark(-1);
	}
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:13,代码来源:MarkUtils.java

示例5: consoleDispatch

import org.eclipse.ui.console.TextConsoleViewer; //导入方法依赖的package包/类
/**
 * When called from a console context, will use ST.CUT
 * 
 * @see com.mulgasoft.emacsplus.commands.ConsoleCmdHandler#consoleDispatch(TextConsoleViewer,
 *      IConsoleView, ExecutionEvent)
 */
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
	if (viewer.isEditable()) {
		IDocument doc = viewer.getDocument();
		StyledText st = viewer.getTextWidget();
		int offset = st.getCaretOffset();
		try {
			IRegion info = doc.getLineInformationOfOffset(offset);
			int noffset = info.getOffset() + info.getLength();
			if (offset == noffset) {
				int line = doc.getLineOfOffset(offset);
				if (++line < doc.getNumberOfLines()) {
					noffset = doc.getLineOffset(line);
					if (noffset == doc.getLength()) {
						noffset = offset;
					}
				}
			}
			if (offset != noffset) {
				st.redraw();
				st.setSelection(offset, noffset);
				KillRing.getInstance().setKill(CUT_LINE_TO_END, false);
				return super.consoleDispatch(viewer, activePart, event);
			}
			viewer.refresh();
		} catch (BadLocationException e) {
		}
	}
	return null;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:36,代码来源:KillLineHandler.java

示例6: consoleDispatch

import org.eclipse.ui.console.TextConsoleViewer; //导入方法依赖的package包/类
/**
 * @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(TextConsoleViewer, IConsoleView, ExecutionEvent)
 */
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
	RecenterState saveState = recenterState;
	try {
		StyledText st = viewer.getTextWidget();
		st.redraw();
		recenter(st);
	} finally {
		recenterState = saveState;
	}
	return null;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:15,代码来源:RecenterHandler.java

示例7: browseRing

import org.eclipse.ui.console.TextConsoleViewer; //导入方法依赖的package包/类
/**
 * Navigate up or down the ring entry by entry
 * 
 * @param viewer the viewer on the console
 * @param dir FORWARD or BACKWARD
 */
private void browseRing(TextConsoleViewer viewer, int dir) {
	IDocument doc = viewer.getDocument(); 
	StyledText st = viewer.getTextWidget();
	if (doc != null && st != null) {
		int lines = doc.getNumberOfLines();
		int off = st.getCaretOffset();
		
		try {
			int l = doc.getLineOfOffset(off);
			KilledText okill = offsetHash.get(doc.getLineOffset(l));
			KilledText nkill = null;
			int noff = -1;
			while ((l = l+dir) > -1 && l < lines){
				off = doc.getLineOffset(l);
				KilledText tkill = offsetHash.get(off);
				if (nkill == null) {
					if (tkill != null && tkill != okill) {
						nkill = offsetHash.get(off);
						noff = off;
						if (dir == FORWARD) {
							break;
						}
					}
				} else {
					if (tkill != null && tkill != nkill){
						break;
					} else {
						noff = off;
					}
				}
			}
			if (noff > -1) {
				st.setCaretOffset(noff);
				viewer.revealRange(noff, 0);
			}
		}catch (BadLocationException e) {
		}
	}
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:46,代码来源:BrowseKillRingHandler.java

示例8: getLineOffset

import org.eclipse.ui.console.TextConsoleViewer; //导入方法依赖的package包/类
/** 
 * Get the line offset of the cursor
 * 
 * @param viewer the console viewer
 * @return the line offset
 */
private int getLineOffset(TextConsoleViewer viewer) {
	int result = -1;
	IDocument doc = viewer.getDocument(); 
	StyledText st = viewer.getTextWidget();
	if (doc != null && st != null) {
		int off = st.getCaretOffset();
		try {
			IRegion info = doc.getLineInformationOfOffset(off);
			result = info.getOffset();
		}catch (BadLocationException e) {
		}
	}
	return result;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:21,代码来源:BrowseKillRingHandler.java

示例9: consoleDispatch

import org.eclipse.ui.console.TextConsoleViewer; //导入方法依赖的package包/类
/**
 * When called from a console context, use paste
 * 
 * @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(org.eclipse.ui.console.TextConsoleViewer, org.eclipse.ui.console.IConsoleView, org.eclipse.core.commands.ExecutionEvent)
 */
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {

	StyledText st = viewer.getTextWidget();
	try {
		// set directly from the widget
		widgetEol = st.getLineDelimiter();
		paste(event,st,activePart.getConsole() instanceof IConsole);
	} finally {
		st.redraw();
		widgetEol = null;
	}
	
	return null;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:20,代码来源:BaseYankHandler.java


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