/** * Shows a page with no children to be used if the desire is to not show * any registered page. */ public void showEmptyPage() { if (emptyPage == null) { emptyPage = createPage(); emptyPage.setLayout(new GridLayout()); } pageBook.showPage(emptyPage); currentPage = emptyPage; reflow(true); } /**
@Override public void setFocus() { if (model.isDynamic()) { if (mainPageBook.getCurrentPage() != null) mainPageBook.getCurrentPage().setFocus(); } }
public boolean hasPage(String pageId) { return categoryPageBook.hasPage(pageId); }
/** * Creates a new instance in the provided parent and with the provided * style. * * @param parent * the control parent * @param style * the style to use */ public ScrolledPageBook(Composite parent, int style) { super(parent, style); pageBook = new WrappedPageBook(this, SWT.NULL); setContent(pageBook); pages = new Hashtable<>(); setExpandHorizontal(true); setExpandVertical(true); this.addListener(SWT.Traverse, e -> { switch (e.detail) { case SWT.TRAVERSE_ESCAPE: case SWT.TRAVERSE_RETURN: case SWT.TRAVERSE_TAB_NEXT: case SWT.TRAVERSE_TAB_PREVIOUS: e.doit = true; break; } }); } /**
/** * Creates a scrolled page book widget as a part of the form. * * @param parent * the page book parent * @param style * the text style * @return the scrolled page book widget */ public ScrolledPageBook createPageBook(Composite parent, int style) { ScrolledPageBook book = new ScrolledPageBook(parent, style | orientation); adapt(book, true, true); book.setMenu(parent.getMenu()); return book; }
private void pluginSelected(IPluginModelBase model, boolean checked) { TracingPropertySource source = getPropertySource(model); if (source == null) { fPageBook.showEmptyPage(); } else { PageBookKey key = new PageBookKey(model, checked); if (!fPageBook.hasPage(key) || source.isChanged()) { Composite parent = fPageBook.createPage(key); source.createContents(parent, checked); source.setChanged(false); } fPageBook.showPage(key); } }
@Override public void run() { if (!pageBook.hasPage(key)) { Composite parent = pageBook.createPage(key); fpage.createContents(parent); parent.setData(fpage); } //commit the current page if (oldPage!=null && oldPage.isDirty()) oldPage.commit(false); //refresh the new page if (fpage.isStale()) fpage.refresh(); fpage.selectionChanged(masterPart, currentSelection); pageBook.showPage(key); } });
SharedStyleManager sharedStyleManager) { if (!categoryPageBook.hasPage(page.getId())) { categoryForm.createPartControl(categoryPageBook, styleManager); categoryPageBook.showPage(page.getId()); Composite pageComposite = (Composite) categoryPageBook.getCurrentPage();
/** * Shows the page with the provided key and hides the page previously * showing. Does nothing if the page with that key does not exist. * * @param key * the page key */ public void showPage(Object key) { Control page = pages.get(key); if (page != null) { pageBook.showPage(page); if (currentPage != null && currentPage != page) { // switching pages - force layout if (page instanceof Composite) ((Composite) page).layout(false); } currentPage = page; } else { showEmptyPage(); } reflow(true); } /**
/** * Removes the page under the provided key from the page book. Does nothing * if page with that key does not exist. * * @param key * the page key. */ public void removePage(Object key) { removePage(key, true); } /**
pageBook.setLayoutData(new GridData(GridData.FILL_BOTH)); boolean pageHasNavigation = styleManager.showHomePageNavigation(); if (pageToShow != null) { if (pageBook.hasPage(pageToShow.getId())) pageBook.showPage(pageToShow.getId()); else { if (pageHasNavigation) { .showPage(PageFormWithNavigation.PAGE_FORM_WITH_NAVIGATION_ID); } else { pageBook.showPage(PageForm.PAGE_FORM_ID);
private boolean showCachedPage(AbstractIntroPage page) { String formPageId = null; if (pageForm.hasPage(page.getId())) { pageForm.showPage(page, sharedStyleManager); formPageId = PageForm.PAGE_FORM_ID; } else if (pageFormWithNav.hasPage(page.getId())) { pageFormWithNav.showPage(page, sharedStyleManager); formPageId = PageFormWithNavigation.PAGE_FORM_WITH_NAVIGATION_ID; } else if (mainPageBook.hasPage(page.getId())) formPageId = page.getId(); else return false; mainPageBook.showPage(formPageId); return true; }
private void removeCachedPage(AbstractIntroPage page) { if (pageForm.hasPage(page.getId())) pageForm.removePage(page.getId()); else if (pageFormWithNav.hasPage(page.getId())) pageFormWithNav.removePage(page.getId()); else if (mainPageBook.hasPage(page.getId())) mainPageBook.removePage(page.getId()); else return; }
/** * Clear page cache for the page that contains this provider. Remove the * form from the correct pagebook that refers to the page we need to * refresh. This will force a call to createContents on all content * providers the next time this page needs to be displayed. * * @see org.eclipse.ui.intro.config.IIntroContentProviderSite#reflow(org.eclipse.ui.intro.config.IIntroContentProvider, * boolean) */ @Override public void reflow(IIntroContentProvider provider, boolean incremental) { AbstractIntroPage page = ContentProviderManager.getInst() .getContentProviderParentPage(provider); if (incremental) { if (pageForm.hasPage(page.getId())) pageForm.reflow(); else if (pageFormWithNav.hasPage(page.getId())) pageFormWithNav.reflow(); else if (mainPageBook.hasPage(page.getId())) mainPageBook.reflow(true); } else { removeCachedPage(page); showPage(model.getCurrentPage()); } }
/** * Creates a new page for the provided key. Use the returned composite to * create children in it. * * @param key * the page key * @return the newly created page composite */ public Composite createPage(Object key) { Composite page = createPage(); pages.put(key, page); return page; } /**
private void masterCheckChanged(boolean userChange) { boolean enabled = fTracingCheck.getSelection(); fPluginViewer.getTable().setEnabled(enabled); Control currentPage = fPageBook.getCurrentPage(); if (currentPage != null && enabled == false) { fPageBook.showEmptyPage(); } if (enabled) { fPluginViewer.setInput(getTraceableModels()); } int count = 0; if(fPluginViewer!=null) count = fPluginViewer.getTable().getItemCount(); fSelectAllButton.setEnabled(enabled && count > 0); fDeselectAllButton.setEnabled(enabled && count > 0); fRestoreDefaultButton.setEnabled(enabled && count > 0); fRestoreSelectedDefaultButton.setEnabled(!fPluginViewer.getStructuredSelection().isEmpty()); if (enabled == false) { fRestoreSelectedDefaultButton.setEnabled(false); } }
public void reflow() { categoryPageBook.reflow(true); }
BusyIndicator.showWhile(pageBook.getDisplay(), new Runnable() { @Override public void run() { pageBook.showEmptyPage();
protected int createPropertySheet(Composite parent) { fToolkit = new FormToolkit(parent.getDisplay()); int toolkitBorderStyle = fToolkit.getBorderStyle(); int style = toolkitBorderStyle == SWT.BORDER ? SWT.NULL : SWT.BORDER; Composite container = new Composite(parent, style); FillLayout flayout = new FillLayout(); flayout.marginWidth = 1; flayout.marginHeight = 1; container.setLayout(flayout); container.setLayoutData(new GridData(GridData.FILL_BOTH)); fPageBook = new ScrolledPageBook(container, style | SWT.V_SCROLL | SWT.H_SCROLL); fToolkit.adapt(fPageBook, false, false); createRestoreButtonSection(parent); if (style == SWT.NULL) { fPageBook.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER); fToolkit.paintBordersFor(container); } return style == SWT.NULL ? 2 : 0; }
/** * Removes the page under the provided key from the page book. Does nothing * if page with that key does not exist. * * @param key * the page key. * @param showEmptyPage * if <code>true</code>, shows the empty page * after page removal. */ public void removePage(Object key, boolean showEmptyPage) { Control page = pages.get(key); if (page != null) { pages.remove(key); page.dispose(); if (showEmptyPage) showEmptyPage(); } } /**