org.eclipse.ui.part.IPageBookViewPage Java Examples

The following examples show how to use org.eclipse.ui.part.IPageBookViewPage. 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: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private void updateOutLineView( IFormPage activePageInstance )
{
	if ( outlinePage == null )
	{
		return;
	}

	if ( reloadOutlinePage( ) )
	{
		return;
	}
	Object designOutLinePage = activePageInstance.getAdapter( IContentOutlinePage.class );
	if ( designOutLinePage instanceof DesignerOutlinePage )
	{
		( (DesignerOutlinePage) designOutLinePage ).setBackupState( outlineBackup );
	}
	outlinePage.setActivePage( (IPageBookViewPage) designOutLinePage );
}
 
Example #2
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void outlineSwitch( )
{
	if ( !getActivePageInstance( ).getId( ).equals( XMLSourcePage_ID )
			|| outlinePage == null )
	{
		return;
	}

	if ( outlinePage.getCurrentPage( ) instanceof DesignerOutlinePage )
	{
		outlinePage.setActivePage( (IPageBookViewPage) getActivePageInstance( ).getAdapter( ContentOutlinePage.class ) );
	}
	else
	{
		outlinePage.setActivePage( (IPageBookViewPage) getActivePageInstance( ).getAdapter( IContentOutlinePage.class ) );
	}
	outlinePage.getSite( ).getActionBars( ).updateActionBars( );
}
 
Example #3
Source File: DeployConsolePageParticipant.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
  Preconditions.checkArgument(console instanceof DeployConsole,
                              "console should be instance of %s",
                              DeployConsole.class.getName());
  this.console = (DeployConsole) console;

  console.addPropertyChangeListener(new IPropertyChangeListener() {
    @Override
    public void propertyChange(PropertyChangeEvent event) {
      if (event.getProperty().equals(DeployConsole.PROPERTY_JOB)) {
        // keep the order of adding a listener and then calling update() to ensure update
        // is called regardless of when the job finishes
        addJobChangeListener();
        update();
      }
    }
  });
  IActionBars actionBars = page.getSite().getActionBars();
  configureToolBar(actionBars.getToolBarManager());
  // keep the order of adding a listener and then calling update() to ensure update
  // is called regardless of when the job finishes
  addJobChangeListener();
  update();
}
 
Example #4
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public boolean reloadOutlinePage( )
{
	if ( !getActivePageInstance( ).getId( ).equals( XMLSourcePage_ID )
			|| outlinePage == null
			|| !getCurrentPageInstance( ).getId( )
					.equals( XMLSourcePage_ID ) )
	{
		return false;
	}

	if ( outlinePage.getCurrentPage( ) instanceof DesignerOutlinePage
			|| outlinePage.getCurrentPage( ) == null
			|| outlinePage.getCurrentPage( ) instanceof EmptyPage )
	{
		outlinePage.setActivePage( (IPageBookViewPage) getActivePageInstance( ).getAdapter( IContentOutlinePage.class ) );
	}
	else
	{
		outlinePage.setActivePage( (IPageBookViewPage) getActivePageInstance( ).getAdapter( ContentOutlinePage.class ) );
	}
	if ( outlinePage.getSite( ) != null )
	{
		outlinePage.getSite( ).getActionBars( ).updateActionBars( );
	}
	return true;
}
 
Example #5
Source File: CasEditorView.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * Creates the view page.
 *
 * @param casViewPageBookedPage the cas view page booked page
 * @param editor the editor
 */
private void createViewPage( CasEditorViewPage casViewPageBookedPage, ICasEditor editor) {
  
  IPageBookViewPage page = doCreatePage(editor);
  if (page != null) {
    try {
      page.init(new SubPageSite(casViewPageBookedPage.getSite()));
    } catch (PartInitException e) {
      CasEditorPlugin.log(e);
    }
    
    casViewPageBookedPage.setCASViewPage(page);
  }
  else {
    casViewPageBookedPage.setCASViewPage(null);
  }
}
 
Example #6
Source File: PromptOverlayConsolePageParticipant.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
    if (!(console instanceof ProcessConsole)) {
        return;
    }
    ProcessConsole processConsole = (ProcessConsole) console;
    IProcess process = processConsole.getProcess();
    if (process == null) {
        return;
    }

    String attribute = process.getAttribute(Constants.PYDEV_DEBUG_IPROCESS_ATTR);
    if (!Constants.PYDEV_DEBUG_IPROCESS_ATTR_TRUE.equals(attribute)) {
        //Only provide the console page
        return;
    }
    if (page instanceof IOConsolePage) {
        final CurrentPyStackFrameForConsole currentPyStackFrameForConsole = new CurrentPyStackFrameForConsole(
                console);
        IOConsolePage consolePage = (IOConsolePage) page;
        this.promptOverlay = new PromptOverlay(consolePage, processConsole, currentPyStackFrameForConsole);
    }

}
 
Example #7
Source File: RestartLaunchAction.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public RestartLaunchAction(IPageBookViewPage page, ProcessConsole console) {
    this.page = page;
    this.console = console;
    launch = this.console.getProcess().getLaunch();
    launchConfiguration = launch.getLaunchConfiguration();

    lastLaunch = launch;
    lastConfig = launch.getLaunchConfiguration();

    update();
}
 
Example #8
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void updatePaletteView( IFormPage activePageInstance )
{

	if ( fPalettePage == null )
	{
		return;
	}

	Object palette = activePageInstance.getAdapter( PalettePage.class );
	fPalettePage.setActivePage( (IPageBookViewPage) palette );
}
 
Example #9
Source File: ReportMultiBookPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public void selectionChanged( SelectionChangedEvent event )
{
	setSelection( event.getSelection( ) );
	StructuredSelection selection = (StructuredSelection) event.getSelection( );
	Object obj = selection.getFirstElement( );
	if ( obj instanceof IFormPage )
	{
		Object palette = ( (IFormPage) obj ).getAdapter( PalettePage.class );
		setActivePage( (IPageBookViewPage) palette );
	}
}
 
Example #10
Source File: AttributeView.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new page in the pagebook for a particular part. This page will
 * be made visible whenever the part is active, and will be destroyed with a
 * call to <code>doDestroyPage</code>.
 * 
 * @param part
 *            the input part
 * @return the record describing a new page for this view
 * @see #doDestroyPage
 */
protected PageRec doCreatePage( IWorkbenchPart part )
{
	Object page = part.getAdapter( IAttributeViewPage.class );
	if ( page instanceof IPageBookViewPage )
	{
		initPage( (IPageBookViewPage) page );

		( (IPageBookViewPage) page ).createControl( getPageBook( ) );

		return new PageRec( part, (IPageBookViewPage) page );
	}
	return null;
}
 
Example #11
Source File: EmacsPlusConsole.java    From e4macs with Eclipse Public License 1.0 5 votes vote down vote up
/**
    * @see org.eclipse.ui.console.IConsole#createPage(org.eclipse.ui.console.IConsoleView)
    */
public IPageBookViewPage createPage(IConsoleView view) {
   	IPageBookViewPage page = super.createPage(view);
       if (page instanceof TextConsolePage) {
       	myPage = (TextConsolePage)page;
       }
       return page;
   }
 
Example #12
Source File: ConsoleActivateDebugContext.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
    this.page = page;
    this.console = (PydevConsole) console;

    view = (IConsoleView) page.getSite().getPage().findView(IConsoleConstants.ID_CONSOLE_VIEW);
    DebugUITools.getDebugContextManager().getContextService(page.getSite().getWorkbenchWindow())
            .addDebugContextListener(this);
}
 
Example #13
Source File: N4JSStackTracePageParticipant.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
	closeAction = new CloseConsoleAction(console);

	IToolBarManager manager = page.getSite().getActionBars().getToolBarManager();
	manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, closeAction);
}
 
Example #14
Source File: ConsoleRestartLaunchPageParticipant.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
    try {
        if (!(console instanceof ProcessConsole)) {
            return;
        }
        ProcessConsole processConsole = (ProcessConsole) console;
        IProcess process = processConsole.getProcess();
        if (process == null) {
            return;
        }
        String attribute = process.getAttribute(IMiscConstants.PYDEV_ADD_RELAUNCH_IPROCESS_ATTR);
        if (!IMiscConstants.PYDEV_ADD_RELAUNCH_IPROCESS_ATTR_TRUE.equals(attribute)) {
            //Only provide relaunch if specified
            return;
        }
        this.fConsole = processConsole;
        DebugPlugin.getDefault().addDebugEventListener(this);

        IActionBars bars = page.getSite().getActionBars();

        IToolBarManager toolbarManager = bars.getToolBarManager();

        restartLaunchAction = new RestartLaunchAction(page, processConsole);
        terminateAllLaunchesAction = new TerminateAllLaunchesAction();

        toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, restartLaunchAction);
        toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAllLaunchesAction);

        bars.updateActionBars();
    } catch (Exception e) {
        Log.log(e);
    }

}
 
Example #15
Source File: BonitaContentOutlineTreeView.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected PageRec doCreatePage(IWorkbenchPart part) {
    Object obj = Adapters.adapt(part, IContentOutlinePage.class, false);
    if (obj instanceof IContentOutlinePage && part instanceof DiagramEditor) {
        TreeViewer viewer = new TreeViewer();
        viewer.setRootEditPart(new DiagramRootTreeEditPart());
        IContentOutlinePage page = new BonitaTreeOutlinePage(viewer, (DiagramEditor) part);
        if (page instanceof IPageBookViewPage) {
            initPage((IPageBookViewPage) page);
        }
        page.createControl(getPageBook());
        return new PageRec(part, page);
    }
    return null;
}
 
Example #16
Source File: OutlinePageBook.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
protected void initializeAndShowPage(final IPageBookViewPage page) {
  
  if (viewer != null)
    viewer.removeSelectionChangedListener(this);
  
  IPageSite site = new SubPageSite(getSite());

  if (book != null && page != null) {
    try {
      page.init(site);
    } catch (PartInitException e) {
      CasEditorPlugin.log(e);
    }
  }

  super.initializeAndShowPage(page);
  
  if (book != null) {
    if (page != null) {
      viewer = ((AnnotationOutline) page).getViewer();
      viewer.addSelectionChangedListener(this);
    }
    else {
      viewer = null;
    }
  }
}
 
Example #17
Source File: CasEditorViewPage.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Creates and shows the page, if page is null
 * the not available message will be shown.
 *
 * @param page the page
 */
protected void initializeAndShowPage(IPageBookViewPage page) {
  if (book != null) {
    if (page != null) {
      page.createControl(book);
      casViewPage = page;
      
      // Note: If page is in background event listening must be disabled!
      ISelectionProvider selectionProvider = page.getSite().getSelectionProvider();
      selectionProvider.addSelectionChangedListener(CasEditorViewPage.this::selectionChanged);
      
      subActionBar = (SubActionBars) casViewPage.getSite().getActionBars();
      
      casViewPage.setActionBars(subActionBar);

      subActionBar.activate();
      subActionBar.updateActionBars();

      refreshActionHandlers();
      
      book.showPage(page.getControl());
    }
    else {
      book.showPage(messageText);
      getSite().getActionBars().updateActionBars();
    }
  }
}
 
Example #18
Source File: CasEditorViewPage.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the CAS view page.
 *
 * @param page the new CAS view page
 */
public void setCASViewPage(IPageBookViewPage page) {
  
  if (book != null && casViewPage != null) {
    casViewPage.dispose();
    subActionBar.dispose();
  }
  
  casViewPage = page;
  
  initializeAndShowPage(page);
}
 
Example #19
Source File: AnnotationStyleView.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
protected IPageBookViewPage doCreatePage(ICasEditor editor) {
  IPageBookViewPage result = null;

  if (editor.getDocument() != null && editor instanceof AnnotationEditor) {
    result = new AnnotationStyleViewPage((AnnotationEditor) editor);
  }

  return result;
}
 
Example #20
Source File: EditView.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
@Override
protected IPageBookViewPage doCreatePage(ICasEditor editor) {
  IPageBookViewPage result = null;

  ICasDocument document = editor.getDocument();
  if (document != null) {
    result = new EditViewPage(this, editor, document);
  }

  return result;
}
 
Example #21
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void updateAttributeView( IFormPage activePageInstance )
{
	if ( attributePage == null )
	{
		return;
	}

	Object adapter = activePageInstance.getAdapter( IAttributeViewPage.class );
	attributePage.setActivePage( (IPageBookViewPage) adapter );
}
 
Example #22
Source File: SocketConsolePageParticipant.java    From codewind-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
	if (console instanceof SocketConsole) {
		ShowOnContentChangeAction contentChange = new ShowOnContentChangeAction((SocketConsole)console);
		
		// Contribute to the toolbar
        IActionBars actionBars = page.getSite().getActionBars();
        IToolBarManager mgr = actionBars.getToolBarManager();
        mgr.appendToGroup(IConsoleConstants.OUTPUT_GROUP, contentChange);
	}
}
 
Example #23
Source File: ItemTraceConsolePageParticipant.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init ( final IPageBookViewPage page, final IConsole console )
{
    final ItemTraceIOConsole traceConsole = (ItemTraceIOConsole)console;

    this.mgr = page.getSite ().getActionBars ().getToolBarManager ();
    this.mgr.appendToGroup ( IConsoleConstants.OUTPUT_GROUP, new StopAction ( traceConsole ) );
    this.mgr.appendToGroup ( IConsoleConstants.OUTPUT_GROUP, new CloseAction ( traceConsole ) );
}
 
Example #24
Source File: LocalAppEngineConsolePageParticipant.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
  this.console = (LocalAppEngineConsole) console;

  // contribute to toolbar
  IActionBars actionBars = page.getSite().getActionBars();
  configureToolBar(actionBars.getToolBarManager());

  LocalAppEngineServerBehaviour serverBehaviour = this.console.getServerBehaviourDelegate();
  if (serverBehaviour != null) {
    serverBehaviour.getServer().addServerListener(serverStateListener);
  }
}
 
Example #25
Source File: XtextBuildConsolePageParticipant.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
	fCloseAction = new CloseConsoleAction(console);
	
	IToolBarManager manager = page.getSite().getActionBars().getToolBarManager();
	manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fCloseAction);
}
 
Example #26
Source File: TypeScriptConsolePageParticipant.java    From typescript.java with MIT License 5 votes vote down vote up
@Override
public void init(IPageBookViewPage page, IConsole console) {
	this.fConsole = (TypeScriptConsole) console;
	this.fTerminate = new ConsoleTerminateAction(fConsole.getProject());
	IActionBars actionBars = page.getSite().getActionBars();
	configureToolBar(actionBars.getToolBarManager());
}
 
Example #27
Source File: ConsolePageParticipant.java    From LogViewer with Eclipse Public License 2.0 5 votes vote down vote up
public void init(IPageBookViewPage myPage, IConsole console) {
       page = myPage;
       IToolBarManager toolBarManager = page.getSite().getActionBars()
       .getToolBarManager();
       toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, new Separator());
       toolBarManager.appendToGroup(IConsoleConstants.OUTPUT_GROUP, new Action(
       		LogViewerPlugin.getResourceString("logviewer.action.openwith.name"),
       		UIImages.getImageDescriptor(ILogViewerConstants.IMG_LOG_VIEWER)) {
           public void run() {
           	ConsolePageParticipant.this.run();
           }
       });
}
 
Example #28
Source File: ConsoleThemePageParticipant.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
public void init(IPageBookViewPage page, IConsole console)
{
	if (console instanceof TextConsole)
	{
		TextConsole textConsole = (TextConsole) console;
		Object themeConsoleStreamToColor = textConsole.getAttribute(THEME_CONSOLE_STREAM_TO_COLOR_ATTRIBUTE);
		if (themeConsoleStreamToColor instanceof Map<?, ?>)
		{
			Map m = (Map) themeConsoleStreamToColor;
			Set<Map.Entry> entrySet = m.entrySet();
			for (Map.Entry entry : entrySet)
			{
				if (!(entry.getKey() instanceof IOConsoleOutputStream) || !(entry.getValue() instanceof String))
				{
					return; // Cannot handle it.
				}
			}
			this.extension = new ConsoleThemer(textConsole, (Map) themeConsoleStreamToColor);
		}
		if (page instanceof TextConsolePage)
		{
			TextConsolePage tcp = (TextConsolePage) page;
			TextViewerThemer themer = new TextViewerThemer(tcp.getViewer());
			themer.apply();
		}
	}
	this.page = page;
}
 
Example #29
Source File: MultiPageReportEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void updateDateView( IFormPage activePageInstance )
{
	if ( dataPage == null )
	{
		return;
	}

	Object adapter = activePageInstance.getAdapter( IDataViewPage.class );
	if ( adapter instanceof DataViewTreeViewerPage )
	{
		( (DataViewTreeViewerPage) adapter ).setBackupState( dataBackup );
	}
	dataPage.setActivePage( (IPageBookViewPage) adapter );
}
 
Example #30
Source File: ScriptConsole.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates the actual page to be shown to the user.
 */
@Override
public IPageBookViewPage createPage(IConsoleView view) {
    page = new ScriptConsolePage(this, view, createSourceViewerConfiguration());
    return page;
}