类org.eclipse.ui.part.PageBookView源码实例Demo

下面列出了怎么用org.eclipse.ui.part.PageBookView的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: LogViewer   文件: ResourceUtils.java
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;
  }
 
源代码2 项目: e4macs   文件: EmacsPlusCmdHandler.java
/**
 * @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();
		}
	}
}
 
 类所在包
 同包方法