Java 类org.eclipse.ui.console.TextConsoleViewer 实例源码

项目:e4macs    文件:MarkExchangeHandler.java   
/**
 * 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;
}
项目:e4macs    文件:BackwardUpListHandler.java   
/**
 * @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;
}
项目:e4macs    文件:SexpBaseBackwardHandler.java   
/**
 * @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;
}
项目:e4macs    文件:EmacsMovementHandler.java   
/**
 * @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;
}
项目:e4macs    文件:SexpBaseForwardHandler.java   
/**
 * @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;
}
项目:e4macs    文件:ConsoleCmdHandler.java   
/**
     * @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;
    }
项目:asakusafw-shafu    文件:ConsoleDialog.java   
@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();
}
项目:e4macs    文件:MarkUtils.java   
/**
 * 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);
    }
}
项目:e4macs    文件:DeletePreviousHandler.java   
/**
 * @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; 
}
项目:e4macs    文件:MarkSetHandler.java   
/**
 * 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;
}
项目:e4macs    文件:BackwardUpListHandler.java   
/**
 * @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);
    }
}
项目:e4macs    文件:SexpHandler.java   
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;
}
项目:e4macs    文件:SexpHandler.java   
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;
}
项目:e4macs    文件:ConsoleCopyCutHandler.java   
/**
 * @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;
}
项目:e4macs    文件:ConsoleCopyCutHandler.java   
/**
 * @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;
}
项目:e4macs    文件:DeleteNextHandler.java   
/**
 * @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; 
}
项目:e4macs    文件:KillLineHandler.java   
/**
 * 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;
}
项目:e4macs    文件:RecenterHandler.java   
/**
 * @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;
}
项目:e4macs    文件:ConsoleCmdHandler.java   
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);
         }
    }
项目:e4macs    文件:BrowseKillRingHandler.java   
/**
 * 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) {
        }
    }
}
项目:e4macs    文件:BrowseKillRingHandler.java   
/** 
 * 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;
}
项目:e4macs    文件:BaseYankHandler.java   
/**
 * 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;
}
项目:e4macs    文件:DownListHandler.java   
/**
 * @see com.mulgasoft.emacsplus.commands.SexpBaseForwardHandler#consoleDispatch(TextConsoleViewer, IConsoleView, ExecutionEvent)
 */
public Object consoleDispatch(final TextConsoleViewer viewer, final IConsoleView activePart, ExecutionEvent event) {

    IDocument doc = viewer.getDocument();
    ITextSelection currentSelection = (ITextSelection) viewer.getSelectionProvider().getSelection();
    ITextSelection selection = downList(doc, currentSelection);
    if (selection == null) {
        unbalanced(activePart,false);
    } else {
        endTransform(viewer,selection.getOffset() + selection.getLength(), currentSelection, selection);
    }
    return null;
}
项目:e4macs    文件:DownListHandler.java   
/**
 * @see com.mulgasoft.emacsplus.commands.SexpHandler#endTransform(org.eclipse.ui.console.TextConsoleViewer, int, org.eclipse.jface.text.ITextSelection, org.eclipse.jface.text.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, true);
    }
}
项目:Pydev    文件:ScriptConsolePage.java   
@Override
protected TextConsoleViewer createViewer(Composite parent) {
    ScriptConsole console = (ScriptConsole) getConsole();
    viewer = new ScriptConsoleViewer(parent, console, this, console.createStyleProvider(),
            console.getInitialCommands(), console.getFocusOnStart(), console.getBackspaceAction(),
            console.getAutoEditStrategy(), console.getTabCompletionEnabled(), true);
    viewer.configure(cfg);
    return viewer;
}
项目:n4js    文件:N4IDEXpectView.java   
@Override
public void createPartControl(Composite parent) {

    FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
    fillLayout.marginHeight = 5;
    fillLayout.marginWidth = 5;
    parent.setLayout(fillLayout);

    // main container
    container = new Composite(parent, SWT.BORDER);
    container.setLayout(new FillLayout());

    // create container for stack trace data
    Composite stacktraceDataContainer = new Composite(parent, SWT.BORDER);

    FormLayout formLayout = new FormLayout();
    formLayout.marginHeight = 5;
    formLayout.marginWidth = 5;
    formLayout.spacing = 5;
    stacktraceDataContainer.setLayout(formLayout);

    Composite stackLabelContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
    stackLabelContainer.setLayout(new GridLayout());

    FormData stackLabelFormData = new FormData();
    stackLabelFormData.top = new FormAttachment(0);
    stackLabelFormData.left = new FormAttachment(0);
    stackLabelFormData.right = new FormAttachment(100);
    stackLabelFormData.bottom = new FormAttachment(20);
    stackLabelContainer.setLayoutData(stackLabelFormData);

    Composite stackTraceContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
    stackTraceContainer.setLayout(new FillLayout());

    FormData stackTraceFormData = new FormData();
    stackTraceFormData.top = new FormAttachment(stackLabelContainer);
    stackTraceFormData.left = new FormAttachment(0);
    stackTraceFormData.right = new FormAttachment(100);
    stackTraceFormData.bottom = new FormAttachment(100);
    stackTraceContainer.setLayoutData(stackTraceFormData);

    // Create viewer for test tree in main container
    testTreeViewer = new TreeViewer(container);
    testTreeViewer.setContentProvider(new XpectContentProvider());
    testTreeViewer.setLabelProvider(new XpectLabelProvider(this.testsExecutionStatus));
    testTreeViewer.setInput(null);

    // create stack trace label
    stacktraceLabel = new Label(stackLabelContainer, SWT.SHADOW_OUT);
    FontData fontData = stacktraceLabel.getFont().getFontData()[0];
    Display display = Display.getCurrent();
    // may be null if outside the UI thread
    if (display == null)
        display = Display.getDefault();
    Font font = new Font(display, new FontData(fontData.getName(), fontData
            .getHeight(), SWT.BOLD));
    // Make stack trace label bold
    stacktraceLabel.setFont(font);

    stacktraceLabel.setText(NO_TRACE_MSG);

    // create stack trace console
    MessageConsole messageConsole = new MessageConsole("trace", null);
    stacktraceConsole = new TraceConsole(messageConsole);
    stacktraceConsoleViewer = new TextConsoleViewer(stackTraceContainer, messageConsole);

    // context menu
    getSite().setSelectionProvider(testTreeViewer);
    MenuManager contextMenu = new MenuManager();
    contextMenu.setRemoveAllWhenShown(true);
    getSite().registerContextMenu(contextMenu, testTreeViewer);
    Control control = testTreeViewer.getControl();
    Menu menu = contextMenu.createContextMenu(control);
    control.setMenu(menu);
    activateContext();

    createSelectionActions();

}
项目:APICloud-Studio    文件:ConsoleAutoScrollPageParticipant.java   
public void init(IPageBookViewPage page, IConsole console)
{
    if (console.getType() != IDebugUIConstants.ID_PROCESS_CONSOLE_TYPE || !(page instanceof TextConsolePage))
    {
        return;
    }
    TextConsolePage consolePage = (TextConsolePage) page;
    TextConsoleViewer textViewer = consolePage.getViewer();
    if (!(textViewer instanceof IOConsoleViewer))
    {
        return;
    }
    final IOConsoleViewer viewer = (IOConsoleViewer) textViewer;
    scrollActionEnabled = viewer.isAutoScroll();
    final IToolBarManager toolBarManager = consolePage.getSite().getActionBars().getToolBarManager();
    IAction slAction = null;
    // Look for the ScrollLockAction
    for (IContributionItem item : toolBarManager.getItems())
    {
        if (item instanceof ActionContributionItem)
        {
            IAction action = ((ActionContributionItem) item).getAction();
            if (action instanceof ScrollLockAction)
            {
                slAction = action;
                break;
            }
        }
    }
    textWidget = viewer.getTextWidget();
    listener = new ConsoleListener(viewer, toolBarManager, slAction);

    // Based on Eclipse Snippet191 - Detects scrolling that were initiated by the user.
    textWidget.addListener(SWT.MouseDown, listener);
    textWidget.addListener(SWT.MouseMove, listener);
    textWidget.addListener(SWT.MouseUp, listener);
    textWidget.addListener(SWT.KeyDown, listener);
    textWidget.addListener(SWT.KeyUp, listener);
    ScrollBar vBar = textWidget.getVerticalBar();
    if (vBar != null)
    {
        vBar.addListener(SWT.Selection, listener);
    }
}
项目:CppStyle    文件:CppStyleConsolePage.java   
@Override
protected TextConsoleViewer createViewer(Composite parent) {
    viewer = new CppStyleConsoleViewer(parent, console);
    return viewer;
}
项目:e4macs    文件:SexpSelectBackwardHandler.java   
/**
 * @see com.mulgasoft.emacsplus.commands.SexpHandler#endTransform(TextConsoleViewer, int, ITextSelection, ITextSelection)
 */
protected int endTransform(TextConsoleViewer viewer, int offset, ITextSelection origSelection, ITextSelection selection) {
    // we're expanding a mark selection
    return selectTransform(viewer,offset,origSelection,selection);
}
项目:e4macs    文件:SexpKillBackwardHandler.java   
protected int noSelectTransform(TextConsoleViewer viewer, int offset, ITextSelection selection, boolean moveit) {
    super.noSelectTransform(viewer, offset, selection, moveit);
    return offset;
}
项目:e4macs    文件:SexpBackwardHandler.java   
protected int endTransform(TextConsoleViewer viewer, int offset, ITextSelection origSelection,ITextSelection selection) {
    return noSelectTransform(viewer,offset,selection,false);
}
项目:e4macs    文件:SexpSelectForwardHandler.java   
/**
 * @see com.mulgasoft.emacsplus.commands.SexpHandler#endTransform(TextConsoleViewer, int, ITextSelection, ITextSelection)
 */
protected int endTransform(TextConsoleViewer viewer, int offset, ITextSelection origSelection, ITextSelection selection) {
    return selectTransform(viewer,offset,origSelection,selection);
}
项目:e4macs    文件:SexpForwardHandler.java   
protected int endTransform(TextConsoleViewer viewer, int offset, ITextSelection origSelection, ITextSelection selection) {
    return noSelectTransform(viewer,offset,selection,true);
}
项目:e4macs    文件:SexpKillForwardHandler.java   
protected int noSelectTransform(TextConsoleViewer viewer, int offset, ITextSelection selection, boolean moveit) {
    super.noSelectTransform(viewer, offset, selection, moveit);
    return offset;
}
项目:e4macs    文件:BrowseKillRingHandler.java   
/**
 * @see com.mulgasoft.emacsplus.execute.IEmacsPlusConsoleKey#handleKey(org.eclipse.swt.events.VerifyEvent, org.eclipse.ui.console.TextConsoleViewer)
 */
public void handleKey(VerifyEvent event, TextConsoleViewer viewer) {

    // mask away any extraneous modifier characters for any direct equality tests. see SWT.MODIFIER_MASK
    int sm = event.stateMask & SWT.MODIFIER_MASK;
    if (viewer != null && (sm == 0 || sm == SWT.SHIFT)) {// && 'i' == event.character) {
        int offset;
        boolean reactivate = false;
        switch (event.character){
        case 'i':   // insert
        case 'y':
        case ' ':
            reactivate = true;
        case '\r':
        case '\n':
            event.doit = false;
            offset = getLineOffset(viewer);
            if (offset >= 0) {
                KilledText kill = offsetHash.get(offset);
                if (kill != null) {
                    insertFromBrowseRing(kill.text);
                }
            }
            if (reactivate) {
                EmacsPlusConsole.getInstance().setFocus(false);
            }
            break;
        case 'n':   // next
            event.doit = false;
            browseRing(viewer,FORWARD);
            break;
        case 'p':   // previous
            event.doit = false;
            browseRing(viewer,BACKWARD);
            break;
        case 'g':   // refresh
            event.doit = false;
            updateBrowseRing();
            break;
        case 'q':   // quit
            activateEditor();
            break;
        case 'U':   // undo
            event.doit = false;
            undoEditor();
            break;
        }
    }
}
项目:e4macs    文件:DeleteCharHandler.java   
protected String getId(ExecutionEvent event, TextConsoleViewer viewer) {
    return IEmacsPlusCommandDefinitionIds.DELETE_NEXT; 
}
项目:Pydev    文件:ScriptConsoleViewerWrapper.java   
public ScriptConsoleViewerWrapper(TextConsoleViewer viewer, IInterpreterInfo info) {
    this.viewer = viewer;
    this.info = info;
}
项目:goclipse    文件:ToolsConsolePage.java   
@Override
protected TextConsoleViewer createViewer(Composite parent) {
    return new IOConsoleViewer(parent, (TextConsole)getConsole());
}
项目:e4macs    文件:EmacsPlusCmdHandler.java   
/**
 * Check that all conditions for mark enablement are met on a TextConsole
 * Support single mark only
 *  
 * @param viewer
 * @param selection
 * @return true if mark is set in the context of the selection
 */
protected boolean isMarkEnabled(TextConsoleViewer viewer, ITextSelection selection) {
    int mark = viewer.getMark();    // current mark position
    int len = selection.getLength();
    int off = selection.getOffset();
    // if mark set and in a marked region, or mark has just been set
    return (isMarkSet(mark) && checkMark(mark,off,len)); 
}
项目:e4macs    文件:KeyboardQuitHandler.java   
/**
 * Support simple clear mark/selection on TextConsole
 * 
 * @see com.mulgasoft.emacsplus.commands.IConsoleDispatch#consoleDispatch(TextConsoleViewer, IConsoleView, ExecutionEvent)
 */
public Object consoleDispatch(TextConsoleViewer viewer, IConsoleView activePart, ExecutionEvent event) {
    MarkUtils.clearConsoleMark(viewer);
    return null;
}