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

下面列出了怎么用org.eclipse.ui.part.IPage的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 项目: LogViewer   文件: ResourceUtils.java
public static ITextViewer getViewer(IPage page) {
    if(page == null){
        return null;
    }
    if(page instanceof TextConsolePage) {
        return ((TextConsolePage)page).getViewer();
    }
    if(page.getClass().equals(MessagePage.class)){
        // empty page placeholder
        return null;
    }
    try {
        /*
         * org.eclipse.cdt.internal.ui.buildconsole.BuildConsolePage does not
         * extend TextConsolePage, so we get access to the viewer with dirty tricks
         */
        Method method = page.getClass().getDeclaredMethod("getViewer", (Class<?>[])null);
        method.setAccessible(true);
        return (ITextViewer) method.invoke(page, (Object[])null);
    } catch (Exception e) {
        // AnyEditToolsPlugin.logError("Can't get page viewer from the console page", e);
    }
    return null;
}
 
源代码3 项目: APICloud-Studio   文件: ExpandLevelHandler.java
public Object execute(ExecutionEvent event) throws ExecutionException
{
	// assumes to expand to level 1 if not specified
	int level = 1;
	String levelStr = event.getParameter(LEVEL);
	if (levelStr != null)
	{
		level = Integer.parseInt(levelStr);
	}

	IWorkbenchPart part = HandlerUtil.getActivePart(event);
	if (part instanceof ContentOutline)
	{
		IPage page = ((ContentOutline) part).getCurrentPage();
		if (page instanceof CommonOutlinePage)
		{
			CommonOutlinePage outlinePage = (CommonOutlinePage) page;
			// we want to expand to the specified level and collapse everything below
			outlinePage.collapseAll();
			outlinePage.expandToLevel(level);
		}
	}
	return null;
}
 
源代码4 项目: APICloud-Studio   文件: InvasiveThemeHijacker.java
protected void hijackConsole(IViewPart view)
{
	if (view instanceof ConsoleView)
	{
		IPage currentPage = ((ConsoleView) view).getCurrentPage();
		if (currentPage != null)
		{
			hookTheme(currentPage.getControl(), false);
		}
	}
}
 
源代码5 项目: APICloud-Studio   文件: CollapseAllHandler.java
public Object execute(ExecutionEvent event) throws ExecutionException
{
	IWorkbenchPart part = HandlerUtil.getActivePart(event);
	if (part instanceof ContentOutline)
	{
		IPage page = ((ContentOutline) part).getCurrentPage();
		if (page instanceof CommonOutlinePage)
		{
			((CommonOutlinePage) page).collapseAll();
		}
	}
	return null;
}
 
源代码6 项目: APICloud-Studio   文件: ExpandAllHandler.java
public Object execute(ExecutionEvent event) throws ExecutionException
{
	IWorkbenchPart part = HandlerUtil.getActivePart(event);
	if (part instanceof ContentOutline)
	{
		IPage page = ((ContentOutline) part).getCurrentPage();
		if (page instanceof CommonOutlinePage)
		{
			((CommonOutlinePage) page).expandAll();
		}
	}
	return null;
}
 
源代码7 项目: tesb-studio-se   文件: SpringConfigurationView.java
@Override
protected IPage createDefaultPage(PageBook book) {
    MessagePage page = new MessagePage();
    initPage(page);
    page.createControl(book);
    page.setMessage(CamelDesignerMessages.getString("SpringConfigurationView_defaultMessage")); //$NON-NLS-1$
    return page;
}
 
源代码8 项目: birt   文件: LibraryExplorerView.java
/**
 * Creates and returns the default page for this view.
 * 
 * @param book
 *            the pagebook control
 * @return the default page
 */
protected IPage createDefaultPage( PageBook book )
{
	MessagePage page = new MessagePage( );
	initPage( page );
	page.createControl( book );
	page.setMessage( defaultText );
	return page;
}
 
源代码9 项目: birt   文件: LibraryExplorerView.java
/**
 * Destroys a page in the pagebook for a particular part. This page was
 * returned as a result from <code>doCreatePage</code>.
 * 
 * @param part
 *            the input part
 * @param pageRecord
 *            a page record for the part
 * @see #doCreatePage
 */
protected void doDestroyPage( IWorkbenchPart part, PageRec pageRecord )
{
	if ( treeViewPage != null && prefs != null )
	{
		prefs.removePreferenceChangeListener( treeViewPage );
	}
	
	this.resourceFolder = null;

	IPage page = pageRecord.page;
	page.dispose( );
	pageRecord.dispose( );
}
 
源代码10 项目: birt   文件: DataView.java
/**
 * Creates and returns the default page for this view.
 * 
 * @param book
 *            the pagebook control
 * @return the default page
 */
protected IPage createDefaultPage( PageBook book )
{
	MessagePage page = new MessagePage( );
	initPage( page );
	page.createControl( book );
	page.setMessage( defaultText );
	return page;
}
 
源代码11 项目: birt   文件: AttributeView.java
protected IPage createDefaultPage( PageBook book )
{
	MessagePage page = new MessagePage( );
	initPage( page );
	page.createControl( book );
	page.setMessage( defaultText );
	if ( defaultPartName == null )
	{
		defaultPartName = getPartName( );
	}
	return page;
}
 
源代码12 项目: uima-uimaj   文件: AnnotationOutline.java
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
  
  boolean isForeignSelection = true;
  
  if (part instanceof ContentOutline) {
    ContentOutline contentOutline = (ContentOutline) part;
    
    IPage currentPage = contentOutline.getCurrentPage();
    
    if (currentPage instanceof OutlinePageBook) {
      OutlinePageBook pageBook = (OutlinePageBook) currentPage;
      isForeignSelection = pageBook.getCasViewPage() != this;
    }
  }

  if (isForeignSelection && getSite().getPage().getActiveEditor() == editor) {
    if (selection instanceof StructuredSelection) {
      AnnotationSelection annotations = new AnnotationSelection((StructuredSelection) selection);

      if (!annotations.isEmpty()) {
        ISelection tableSelection = new StructuredSelection(new AnnotationTreeNode(editor
                .getDocument(), annotations.getFirst()));

        mTableViewer.setSelection(tableSelection, true);
      }
    }
  }
}
 
源代码13 项目: uima-uimaj   文件: CasEditorView.java
@Override
protected IPage createDefaultPage(PageBook book) {
  MessagePage page = new MessagePage();
  initPage(page);
  page.createControl(book);
  page.setMessage(editorNotAvailableMessage);
  return page;
}
 
源代码14 项目: uima-uimaj   文件: AnnotationEditorView.java
@Override
protected IPage createDefaultPage(PageBook book) {
  MessagePage page = new MessagePage();
  initPage(page);
  page.createControl(book);
  page.setMessage(editorNotAvailableMessage);
  return page;
}
 
源代码15 项目: 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();
		}
	}
}
 
源代码16 项目: birt   文件: DataView.java
/**
 * Destroys a page in the pagebook for a particular part. This page was
 * returned as a result from <code>doCreatePage</code>.
 * 
 * @param part
 *            the input part
 * @param pageRecord
 *            a page record for the part
 * @see #doCreatePage
 */
protected void doDestroyPage( IWorkbenchPart part, PageRec pageRecord )
{
	IPage page = pageRecord.page;
	page.dispose( );
	pageRecord.dispose( );
}
 
源代码17 项目: birt   文件: AttributeView.java
/**
 * Destroys a page in the pagebook for a particular part. This page was
 * returned as a result from <code>doCreatePage</code>.
 * 
 * @param part
 *            the input part
 * @param pageRecord
 *            a page record for the part
 * @see #doCreatePage
 */
protected void doDestroyPage( IWorkbenchPart part, PageRec pageRecord )
{
	IPage page = pageRecord.page;
	page.dispose( );
	pageRecord.dispose( );
}
 
 类所在包
 类方法
 同包方法