Package org.eclipse.ui.part

Examples of org.eclipse.ui.part.IPageSite


    }

    @Override
    public void activated() {
        // add EOF submissions
        final IPageSite site = fPage.getSite();
        final IHandlerService handlerService = (IHandlerService) site
                .getService(IHandlerService.class);
        final IContextService contextService = (IContextService) site
                .getService(IContextService.class);
        fActivatedContext = contextService.activateContext(fContextId);
        fActivatedHandler = handlerService.activateHandler(
                "org.eclipse.debug.ui.commands.eof", fEOFHandler); //$NON-NLS-1$
    }
View Full Code Here


    }

    @Override
    public void deactivated() {
        // remove EOF submissions
        final IPageSite site = fPage.getSite();
        final IHandlerService handlerService = (IHandlerService) site
                .getService(IHandlerService.class);
        final IContextService contextService = (IContextService) site
                .getService(IContextService.class);
        handlerService.deactivateHandler(fActivatedHandler);
        contextService.deactivateContext(fActivatedContext);
    }
View Full Code Here

            fOutlineViewer.setLabelProvider(editor.createOutlineLabelProvider());
            fOutlineViewer.setInput(fModule);
        }

        fOutlineViewer.addPostSelectionChangedListener(this);
        final IPageSite site = getSite();
        fLinkHelper = new LinkingHelper();

        final IContextService service = (IContextService) site
                .getService(IContextService.class);
        service.activateContext("org.erlide.ui.erlangOutlineAndNavigatorScope");

        final MenuManager manager = new MenuManager();
        manager.setRemoveAllWhenShown(true);
        manager.addMenuListener(new IMenuListener() {
            @Override
            public void menuAboutToShow(final IMenuManager m) {
                // recursive loop?
                // menuAboutToShow(m);
                contextMenuAboutToShow(m);
            }
        });
        final Menu menu = manager.createContextMenu(tree);
        tree.setMenu(menu);

        site.registerContextMenu(ErlangCore.PLUGIN_ID + ".outline", manager,
                fOutlineViewer);
        fActionGroups = new CompositeActionGroup(
                new ActionGroup[] { new ErlangSearchActionGroup(this) });
        // register global actions
        final IActionBars actionBars = site.getActionBars();
        actionBars.setGlobalActionHandler(ITextEditorActionConstants.UNDO,
                editor.getAction(ITextEditorActionConstants.UNDO));
        actionBars.setGlobalActionHandler(ITextEditorActionConstants.REDO,
                editor.getAction(ITextEditorActionConstants.REDO));
        fActionGroups.fillActionBars(actionBars);
        registerToolbarActions(actionBars);
        final IHandlerService handlerService = (IHandlerService) site
                .getService(IHandlerService.class);
        handlerService.activateHandler(
                IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR,
                new ActionHandler(fToggleLinkingAction));
        fPartListener = new IPartListener() {
View Full Code Here

  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) {
View Full Code Here

     * Prepares the page in the given page rec for use in this view.
     *
     * @param rec
     */
    private void preparePage( PageRec<K> rec ) {
        IPageSite site = null;
        // Integer count;

        if (!doesPageExist(rec.page)) {
            if (rec.page instanceof IPageBookViewPage) {
                site = ((IPageBookViewPage) rec.page).getSite();
            }
            if (site == null) {
                // We will create a site for our use
                site = new PageSite(getViewSite());
            }
            // mapPageToSite.put(rec.page, site);
            rec.pageSite = site;

            rec.subActionBars = (SubActionBars) site.getActionBars();
            rec.subActionBars.addPropertyChangeListener(actionBarPropListener);

            // for backward compability with IPage
            rec.page.setActionBars(rec.subActionBars);

            // count = new Integer(0);
        } else {
            site = (IPageSite) rec.pageSite;
            if (site != null) {
                rec.subActionBars = (SubActionBars) site.getActionBars();
            }
            // count = ((Integer) mapPageToNumRecs.get(rec.page));
        }
        // mapPageToNumRecs.put(rec.page, new Integer(count.intValue() + 1));
    }
View Full Code Here

     */
    private void removePage( PageRec<K> rec ) {
        // remove from cache
        mapPartToRec.remove(rec.getTarget());

        IPageSite site = rec.pageSite;

        Control control = rec.page.getControl();
        if (control != null && !control.isDisposed()) {
            // Dispose the page's control so pages don't have to do this in
            // their
View Full Code Here

            return;
        }

        // Hide old page.
        if (activeRec != null) {
            IPageSite pageSite = activeRec.pageSite;
            if (activeRec.subActionBars != null) {
                activeRec.subActionBars.deactivate();
            }

            // deactivate the nested services
            if (pageSite instanceof PageSite) {
                ((PageSite) pageSite).deactivate();
            }
            // remove our selection listener
            if (pageSite != null) {
                ISelectionProvider provider = pageSite.getSelectionProvider();
                if (provider != null) {
                    provider.removeSelectionChangedListener(selectionChangedListener);
                    if (provider instanceof IPostSelectionProvider) {
                        ((IPostSelectionProvider) provider)
                                .removePostSelectionChangedListener(postSelectionListener);
                    }
                }
            }
        }
        // Show new page.
        activeRec = pageRec;
        Control pageControl = activeRec.page.getControl();
        if (pageControl != null && !pageControl.isDisposed()) {
            IPageSite pageSite = activeRec.pageSite;

            // Verify that the page control is not disposed
            // If we are closing, it may have already been disposed
            book.showPage(pageControl);
            if (activeRec.subActionBars != null) {
                activeRec.subActionBars.activate();
            }
            refreshGlobalActionHandlers();

            // activate the nested services
            if (pageSite instanceof PageSite) {
                ((PageSite) pageSite).activate();
            }

            // add our selection listener
            ISelectionProvider provider = pageSite.getSelectionProvider();
            if (provider != null) {
                provider.addSelectionChangedListener(selectionChangedListener);
                if (provider instanceof IPostSelectionProvider) {
                    ((IPostSelectionProvider) provider)
                            .addPostSelectionChangedListener(postSelectionListener);
View Full Code Here

            // during workbench startup we may be in a state when
            // there is no current page
            if (currentPage == null) {
                return StructuredSelection.EMPTY;
            }
            IPageSite site = getPageSite(currentPage);
            if (site == null) {
                return StructuredSelection.EMPTY;
            }
            ISelectionProvider selProvider = site.getSelectionProvider();
            if (selProvider != null) {
                return selProvider.getSelection();
            }
            return StructuredSelection.EMPTY;
        }
View Full Code Here

            // during workbench startup we may be in a state when
            // there is no current page
            if (currentPage == null) {
                return;
            }
            IPageSite site = getPageSite(currentPage);
            if (site == null) {
                return;
            }
            ISelectionProvider selProvider = site.getSelectionProvider();
            // and set its selection
            if (selProvider != null) {
                selProvider.setSelection(selection);
            }
        }
View Full Code Here

    return null;
  }

  @Override
  public void init(IPageBookViewPage page, IConsole console) {
    IPageSite pageSite = page.getSite();
    IWorkbenchPage workbenchPage = pageSite.getPage();
    IViewPart viewPart = workbenchPage.findView(IConsoleConstants.ID_CONSOLE_VIEW );
    IViewSite viewSite = viewPart.getViewSite();
    IActionBars actionBars = viewSite.getActionBars();
    IToolBarManager toolBarManager = actionBars.getToolBarManager();
    IContributionItem[] items = toolBarManager.getItems();
View Full Code Here

TOP

Related Classes of org.eclipse.ui.part.IPageSite

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.