org.eclipse.ui.part.PageBookView Java Examples
The following examples show how to use
org.eclipse.ui.part.PageBookView.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ResourceUtils.java From LogViewer with Eclipse Public License 2.0 | 6 votes |
public static IConsole getConsole(IWorkbenchPart part) { if(!(part instanceof IViewPart)){ return null; } IViewPart vp =(IViewPart) part; if (vp instanceof PageBookView) { IPage page = ((PageBookView) vp).getCurrentPage(); ITextViewer viewer = getViewer(page); if (viewer == null || viewer.getDocument() == null) return null; } IConsole con = null; try { con = ((IConsoleView)part).getConsole(); } catch (Exception e) { } return con; }
Example #2
Source File: EmacsPlusCmdHandler.java From e4macs with Eclipse Public License 1.0 | 4 votes |
/** * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) */ @SuppressWarnings("unchecked") public Object execute(ExecutionEvent event) throws ExecutionException { ITextEditor editor = getTextEditor(event); if (editor == null) { if (isWindowCommand()) { Object result = checkExecute(event); if (result == Check.Fail) { beep(); result = null; } return result; } else if (isConsoleCommand()) { // intercept and dispatch execution if console supported and used in a console view IWorkbenchPart activePart = HandlerUtil.getActivePart(event); if (activePart != null && (activePart instanceof IConsoleView) && (activePart instanceof PageBookView)) { IPage textPage = ((PageBookView)activePart).getCurrentPage(); if (textPage instanceof TextConsolePage) { return ((IConsoleDispatch)this).consoleDispatch(((TextConsolePage)textPage).getViewer(),(IConsoleView)activePart,event); } } } } try { setThisEditor(editor); isEditable = getEditable(); if (editor == null || isBlocked()) { beep(); asyncShowMessage(editor, INEDITABLE_BUFFER, true); return null; } // Retrieve the universal-argument parameter value if passed if (extractUniversalCount(event) != 1) { // check if we should dispatch a related command based on the universal argument String dispatchId = checkDispatchId(event.getCommand().getId()); if (dispatchId != null) { // recurse on new id (inverse or arg value driven) return dispatchId(editor, dispatchId, getParams(event.getCommand(), event.getParameters())); } } setThisDocument(editor.getDocumentProvider().getDocument(editor.getEditorInput())); // Get the current selection ISelectionProvider selectionProvider = editor.getSelectionProvider(); ITextSelection selection = (ITextSelection) selectionProvider.getSelection(); preTransform(editor, selection); return transformWithCount(editor, getThisDocument(), selection, event); } finally { // normal commands clean up here if (isTransform()) { postExecute(); } } }