@Override public void selectionChanged(IWorkbenchPart part, ISelection sel) { // we ignore selection if we are hidden OR selection is coming from // another source as the last one if (part == null || !part.equals(currentPart)) { return; } // we ignore null selection, or if we are pinned, or our own selection // or same selection if (sel == null || !isImportant(part) || sel.equals(currentSelection)) { return; } currentPart = part; currentSelection = sel; boolean visible = getSite() != null && getSite().getPage().isPartVisible(this); if (!visible) { return; } // pass the selection to the page IPropertySheetPage page = (IPropertySheetPage) getCurrentPage(); if (page != null) { page.selectionChanged(currentPart, currentSelection); } updateContentDescription(); }
/** * Returns an <code>ISaveablePart</code> that delegates to the source part * for the current page if it implements <code>ISaveablePart</code>, or * <code>null</code> otherwise. * * @return an <code>ISaveablePart</code> or <code>null</code> * @since 3.2 */ protected ISaveablePart getSaveablePart() { IWorkbenchPart part = getCurrentContributingPart(); if (part instanceof ISaveablePart) { return (ISaveablePart) part; } return null; }
protected PageRec doCreatePage(IWorkbenchPart part) { // Try to get a custom property sheet page. IPropertySheetPage page = (IPropertySheetPage) ViewsPlugin.getAdapter(part, IPropertySheetPage.class, false); if (page != null) { if (page instanceof IPageBookViewPage) { initPage((IPageBookViewPage) page); } page.createControl(getPageBook()); return new PageRec(part, page); } // Use the default page return null; }
private void showSelectionAndDescription() { selectionUpdatePending = false; if (currentPart == null || currentSelection == null) { return; } IPropertySheetPage page = (IPropertySheetPage) getCurrentPage(); if (page != null) { page.selectionChanged(currentPart, currentSelection); } updateContentDescription(); }
@Override protected boolean isImportant(IWorkbenchPart part) { // Don't interfere with other property views String partID = part.getSite().getId(); boolean isPropertyView = getSite().getId().equals(partID); return !isPinned() && !isPropertyView && !isViewIgnored(partID); }
@Override public void selectionChanged(IWorkbenchPart part, ISelection sel) { // we ignore selection if we are hidden OR selection is coming from // another source as the last one if (part == null || !part.equals(currentPart)) { return; } // we ignore null selection, or if we are pinned, or our own selection // or same selection if (sel == null || !isImportant(part) || sel.equals(currentSelection)) { return; } currentPart = part; currentSelection = sel; boolean visible = getSite() != null && getSite().getPage().isPartVisible(this); if (!visible) { selectionUpdatePending = true; return; } // pass the selection to the page showSelectionAndDescription(); }
public void selectionChanged(IWorkbenchPart part, ISelection sel) { // we ignore our own selection or null selection if (part == this || sel == null) { return; } // pass the selection to the page IPropertySheetPage page = (IPropertySheetPage) getCurrentPage(); if (page != null) { page.selectionChanged(part, sel); } }
super.partActivated(part); if (selectionUpdatePending) { showSelectionAndDescription(); IWorkbenchPartSite site = getSite(); IWorkbenchPage page = site.getPage(); IViewPart[] stack = page.getViewStack(this); if(isImportant(part)) { currentPart = part; IPropertySheetPage page = (IPropertySheetPage) getCurrentPage(); if (page != null) { page.selectionChanged(part, bootstrapSelection);
IMenuManager menuManager = getViewSite().getActionBars() .getMenuManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menuManager.add(pinPropertySheetAction); IToolBarManager toolBarManager = getViewSite().getActionBars() .getToolBarManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); toolBarManager.add(pinPropertySheetAction); ISaveablesLifecycleListener saveables = getSite().getService(ISaveablesLifecycleListener.class); if (saveables instanceof SaveablesList) { ((SaveablesList) saveables).addModelLifecycleListener(saveablesTracker); getSite().getPage().getWorkbenchWindow().getWorkbench().getHelpSystem() .setHelp(getPageBook(), IPropertiesHelpContextIds.PROPERTY_SHEET_VIEW);
PropertySheet sheet = (PropertySheet) viewReference .getView(true); if (!sheet.isPinned() || (sheet.isPinned() && sheet.getShowInContext() .equals(context))) { secondaryId = sheet.getViewSite().getSecondaryId(); break;
@Override protected IWorkbenchPart getBootstrapPart() { IWorkbenchPage page = getSite().getPage(); if (page == null) { return null; if (activeEditor != null && isImportant(activeEditor)) { if (activeEditor.getSite().getSelectionProvider() != null) { ISelection selection = activeEditor.getSite().getSelectionProvider().getSelection(); continue; if (!isImportant(part) || part.getSite().getSelectionProvider() == null) { continue;
/** * The <code>PropertySheet</code> implementation of this <code>IWorkbenchPart</code> * method creates a <code>PageBook</code> control with its default page showing. */ public void createPartControl(Composite parent) { super.createPartControl(parent); getSite().getPage().getWorkbenchWindow().getWorkbench().getHelpSystem() .setHelp(getPageBook(), IPropertiesHelpContextIds.PROPERTY_SHEET_VIEW); }
public void dispose() { // run super. super.dispose(); // remove ourselves as a selection listener getSite().getPage().removeSelectionListener(this); }
protected IPage createDefaultPage(PageBook book) { PropertySheetPage page = new PropertySheetPage(); initPage(page); page.createControl(book); return page; }
/** * The <code>PropertySheet</code> implementation of this * <code>PageBookView</code> method handles the <code>ISaveablePart</code> * adapter case by calling <code>getSaveablePart()</code>. * * @since 3.2 */ protected Object getViewAdapter(Class key) { if (ISaveablePart.class.equals(key)) { return getSaveablePart(); } return super.getViewAdapter(key); }
private boolean isViewIgnored(String partID) { return getIgnoredViews().contains(partID); }
/** * @param event * {@link ExecutionEvent} for which the * {@link PropertyShowInContext} is requested * @return a {@link PropertyShowInContext} containing the the * {@link ISelection} and {@link IWorkbenchPart} for the given * {@link ExecutionEvent} * @throws ExecutionException */ protected PropertyShowInContext getShowInContext(ExecutionEvent event) throws ExecutionException { IWorkbenchPart activePart = HandlerUtil.getActivePartChecked(event); if (activePart instanceof PropertySheet) { PropertySheet sheet = (PropertySheet) activePart; return (PropertyShowInContext) sheet.getShowInContext(); } IShowInSource adapter = Adapters.adapt(activePart, IShowInSource.class); if (adapter != null) { ShowInContext showInContext = adapter.getShowInContext(); return new PropertyShowInContext(activePart, showInContext); } return new PropertyShowInContext(activePart, HandlerUtil .getShowInSelection(event)); }
&& ((PropertySheet) part).getCurrentPage() == this;
/** * The <code>PropertySheet</code> implementation of this <code>IWorkbenchPart</code> * method creates a <code>PageBook</code> control with its default page showing. */ @Override public void createPartControl(Composite parent) { super.createPartControl(parent); pinPropertySheetAction.addPropertyChangeListener(new IPropertyChangeListener(){ @Override public void propertyChange(PropertyChangeEvent event) { if (IAction.CHECKED.equals(event.getProperty())) { updateContentDescription(); } } }); IMenuManager menuManager = getViewSite().getActionBars() .getMenuManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); menuManager.add(pinPropertySheetAction); IToolBarManager toolBarManager = getViewSite().getActionBars() .getToolBarManager(); menuManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); toolBarManager.add(pinPropertySheetAction); getSite().getPage().getWorkbenchWindow().getWorkbench().getHelpSystem() .setHelp(getPageBook(), IPropertiesHelpContextIds.PROPERTY_SHEET_VIEW); }
@Override protected boolean isImportant(IWorkbenchPart part) { // Don't interfere with other property views if (part == null) { return false; } IWorkbenchPartSite site = part.getSite(); if (site == null) { return false; } String partID = site.getId(); boolean isPropertyView = getSite().getId().equals(partID); return !isPinned() && !isPropertyView && !isViewIgnored(partID); }