Java Code Examples for org.eclipse.ui.IViewPart#getAdapter()

The following examples show how to use org.eclipse.ui.IViewPart#getAdapter() . 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: TabbedPropertySynchronizerListener.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void updateSelectedTabInPage(final EObject element, final ITabbedPropertySelectionProvider selectionProvider, final IViewPart part) {
    final TabbedPropertySheetPage page = (TabbedPropertySheetPage) part.getAdapter(TabbedPropertySheetPage.class);
    if (page != null) {
        page.setSelectedTab(selectionProvider.tabId(element));
        if (selectionProvider instanceof ITabbedSectionPropertyProvider) {
            final PropertySectionWithTabs sectionWithTabs = findSectionWithTabs(page);
            if (sectionWithTabs != null) {
                sectionWithTabs.setSelectedTab(((ITabbedSectionPropertyProvider) selectionProvider).tabIndex());
            }
        }
    }
}
 
Example 2
Source File: TabbedPropertySynchronizerListener.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private String activePropertyTabId(final IWorkbenchPage activePage, final String viewId) {
    final IViewPart view = activePage.findView(viewId);
    final TabbedPropertySheetPage propertySheetPage = (TabbedPropertySheetPage) view.getAdapter(TabbedPropertySheetPage.class);
    if (propertySheetPage != null && propertySheetPage.getSelectedTab() != null) {
        return propertySheetPage.getSelectedTab().getId();
    }
    return null;
}
 
Example 3
Source File: TabbedPropertySynchronizerListener.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private TabbedPropertySheetPage activePropertyTab(final IWorkbenchPage activePage, final String viewId) {
    final IViewPart view = activePage.findView(viewId);
    final TabbedPropertySheetPage propertySheetPage = (TabbedPropertySheetPage) view.getAdapter(TabbedPropertySheetPage.class);
    if (propertySheetPage != null) {
        return propertySheetPage;
    }
    return null;
}
 
Example 4
Source File: PropertySelectionProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private TabbedPropertySheetPage getTabbedPropertySheetPage(EObject element) throws PartInitException {
    IViewPart viewPart = null;
    for (IViewReference vr : PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences()) {
        if (vr.getId().equals("org.bonitasoft.studio.views.properties.process.general")) {
            viewPart = vr.getView(true);
        }
    }
    if (viewPart != null) {
        viewPart.getViewSite().getWorkbenchWindow().getActivePage().showView(viewPart.getSite().getId());
        return (TabbedPropertySheetPage) viewPart.getAdapter(TabbedPropertySheetPage.class);
    }
    return null;
}