本文整理汇总了Java中org.eclipse.ui.console.TextConsoleViewer类的典型用法代码示例。如果您正苦于以下问题:Java TextConsoleViewer类的具体用法?Java TextConsoleViewer怎么用?Java TextConsoleViewer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextConsoleViewer类属于org.eclipse.ui.console包,在下文中一共展示了TextConsoleViewer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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.SexpBaseBackwardHandler#consoleDispatch(TextConsoleViewer, IConsoleView, ExecutionEvent)
*/
public Object consoleDispatch(final TextConsoleViewer viewer, final IConsoleView activePart, ExecutionEvent event) {
IDocument doc = viewer.getDocument();
boolean isBackup = getUniversalCount() > 0; // normal direction
ITextSelection selection = (ITextSelection) viewer.getSelectionProvider().getSelection();
try {
int offset = doTransform(doc, selection, viewer.getTextWidget().getCaretOffset(),isBackup);
if (offset == NO_OFFSET) {
unbalanced(activePart,false);
} else {
endTransform(viewer, offset, selection, new TextSelection(null,offset,offset - selection.getOffset()));
}
} catch (BadLocationException e) {}
return null;
}
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:19,代码来源:BackwardUpListHandler.java
示例3: 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) {
IDocument document = viewer.getDocument();
ITextSelection currentSelection = (ITextSelection)viewer.getSelectionProvider().getSelection();
ITextSelection selection = null;
try {
selection = getNextSexp(document, currentSelection);
if (selection == null) {
selection = currentSelection;
unbalanced(activePart,true);
return null;
} else {
return endTransform(viewer, selection.getOffset(), currentSelection, selection);
}
} catch (BadLocationException e) {
}
return null;
}
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:22,代码来源:SexpBaseBackwardHandler.java
示例4: 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
示例5: consoleDispatch
import org.eclipse.ui.console.TextConsoleViewer; //导入依赖的package包/类
/**
* @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) {
IDocument document = viewer.getDocument();
ITextSelection currentSelection = (ITextSelection)viewer.getSelectionProvider().getSelection();
ITextSelection selection = new TextSelection(document, viewer.getTextWidget().getCaretOffset(), 0);
try {
selection = getNextSexp(document, selection);
if (selection == null) {
selection = currentSelection;
unbalanced(activePart,true);
return null;
} else {
return endTransform(viewer, selection.getOffset() + selection.getLength(), currentSelection, selection);
}
} catch (BadLocationException e) {
}
return null;
}
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:22,代码来源:SexpBaseForwardHandler.java
示例6: 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
示例7: createDialogArea
import org.eclipse.ui.console.TextConsoleViewer; //导入依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
getShell().setText(Messages.ConsoleDialog_title);
TextConsoleViewer viewer = new TextConsoleViewer(parent, console);
viewer.getControl().setLayoutData(GridDataFactory.fillDefaults()
.grab(true, true)
.hint(convertWidthInCharsToPixels(80), convertHeightInCharsToPixels(20))
.create());
viewer.setEditable(false);
applyDialogFont(viewer.getControl());
return viewer.getControl();
}
开发者ID:asakusafw,项目名称:asakusafw-shafu,代码行数:13,代码来源:ConsoleDialog.java
示例8: 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
示例9: getId
import org.eclipse.ui.console.TextConsoleViewer; //导入依赖的package包/类
/**
* @see com.mulgasoft.emacsplus.commands.ConsoleCmdHandler#getId(ExecutionEvent, TextConsoleViewer)
*/
@Override
protected String getId(ExecutionEvent event, TextConsoleViewer viewer) {
String id = IEmacsPlusCommandDefinitionIds.DELETE_PREVIOUS_WORD;
KillRing.getInstance().setKill(id, true);
return id;
}
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:10,代码来源:DeletePreviousHandler.java
示例10: consoleDispatch
import org.eclipse.ui.console.TextConsoleViewer; //导入依赖的package包/类
/**
* Support simple mark on TextConsole
*
* @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(TextConsoleViewer, IConsoleView, ExecutionEvent)
*/
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
int offset = viewer.getTextWidget().getCaretOffset();
viewer.setSelectedRange(offset, 0);
viewer.setMark(offset);
return null;
}
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:12,代码来源:MarkSetHandler.java
示例11: endTransform
import org.eclipse.ui.console.TextConsoleViewer; //导入依赖的package包/类
/**
* @see com.mulgasoft.emacsplus.commands.SexpHandler#endTransform(TextConsoleViewer, int, ITextSelection, ITextSelection)
*/
@Override
protected int endTransform(TextConsoleViewer viewer, int offset,
ITextSelection origSelection, ITextSelection selection) {
if (isMarkEnabled(viewer, origSelection)) {
return selectTransform(viewer, offset, origSelection, selection);
} else {
return noSelectTransform(viewer, offset, selection, false);
}
}
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:13,代码来源:BackwardUpListHandler.java
示例12: selectTransform
import org.eclipse.ui.console.TextConsoleViewer; //导入依赖的package包/类
protected int selectTransform(TextConsoleViewer viewer, int offset, ITextSelection origSelection, ITextSelection selection) {
// we're expanding a mark selection
int mark = viewer.getMark();
if (mark != -1) {
viewer.setSelectedRange(mark, offset - mark);
}
return NO_OFFSET;
}
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:9,代码来源:SexpHandler.java
示例13: noSelectTransform
import org.eclipse.ui.console.TextConsoleViewer; //导入依赖的package包/类
protected int noSelectTransform(TextConsoleViewer viewer, int offset, ITextSelection selection, boolean moveit) {
// move the cursor if moveit == true
int newOffset = selection.getOffset();
newOffset = (moveit ? newOffset + selection.getLength() : newOffset);
viewer.setSelectedRange(newOffset, 0);
return NO_OFFSET;
}
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:9,代码来源:SexpHandler.java
示例14: getId
import org.eclipse.ui.console.TextConsoleViewer; //导入依赖的package包/类
/**
* @see com.mulgasoft.emacsplus.commands.ConsoleCmdHandler#getId(ExecutionEvent, TextConsoleViewer)
*/
@Override
protected String getId(ExecutionEvent event, TextConsoleViewer viewer) {
String result = null;
if (IEmacsPlusCommandDefinitionIds.CONSOLE_CUT.equals(event.getCommand().getId())){
result = IEmacsPlusCommandDefinitionIds.EMP_CUT;
KillRing.getInstance().setKill(result, false);
} else if (IEmacsPlusCommandDefinitionIds.CONSOLE_COPY.equals(event.getCommand().getId())){
result = IEmacsPlusCommandDefinitionIds.EMP_COPY;
}
return result;
}
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:15,代码来源:ConsoleCopyCutHandler.java
示例15: consoleDispatch
import org.eclipse.ui.console.TextConsoleViewer; //导入依赖的package包/类
/**
* @see com.mulgasoft.emacsplus.commands.ConsoleCmdHandler#consoleDispatch(TextConsoleViewer, IConsoleView, ExecutionEvent)
*/
@Override
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
Object result = null;
IDocument doc = viewer.getDocument();
try {
IWorkbenchPartSite site = activePart.getSite();
if (site != null) {
IHandlerService service = (IHandlerService) site.getService(IHandlerService.class);
if (doc != null && service != null) {
doc.addDocumentListener(KillRing.getInstance());
String cmdId = getId(event, viewer);
if (cmdId != null) {
result = service.executeCommand(cmdId, null);
}
}
}
} catch (CommandException e) {
// Shouldn't happen as the Command id will be null or valid
e.printStackTrace();
} finally {
if (doc != null) {
doc.removeDocumentListener(KillRing.getInstance());
}
// clear kill command flag
KillRing.getInstance().setKill(null, false);
}
MarkUtils.clearConsoleMark(viewer);
return result;
}
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:34,代码来源:ConsoleCopyCutHandler.java
示例16: getId
import org.eclipse.ui.console.TextConsoleViewer; //导入依赖的package包/类
/**
* @see com.mulgasoft.emacsplus.commands.ConsoleCmdHandler#getId(ExecutionEvent, TextConsoleViewer)
*/
@Override
protected String getId(ExecutionEvent event, TextConsoleViewer viewer) {
String id = IEmacsPlusCommandDefinitionIds.DELETE_NEXT_WORD;
KillRing.getInstance().setKill(id, false);
return id;
}
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:10,代码来源:DeleteNextHandler.java
示例17: 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
示例18: 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
示例19: setUpUndo
import org.eclipse.ui.console.TextConsoleViewer; //导入依赖的package包/类
protected void setUpUndo(TextConsoleViewer viewer) {
IDocumentUndoManager undoer = DocumentUndoManagerRegistry.getDocumentUndoManager(viewer.getDocument());
if (undoer == null) {
DocumentUndoManagerRegistry.connect(viewer.getDocument());
// undoer = DocumentUndoManagerRegistry.getDocumentUndoManager(viewer.getDocument());
// viewer.setUndoManager((IUndoManager) undoer);
}
}
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:9,代码来源:ConsoleCmdHandler.java
示例20: 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
注:本文中的org.eclipse.ui.console.TextConsoleViewer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论