org.eclipse.ui.navigator.INavigatorContentService Java Examples
The following examples show how to use
org.eclipse.ui.navigator.INavigatorContentService.
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: TabbedPropertySheetTitleProvider.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
/** * Constructor for CommonNavigatorTitleProvider. */ public TabbedPropertySheetTitleProvider() { super(); IWorkbenchPart part = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage().findView(ProjectExplorer.VIEW_ID); INavigatorContentService contentService = (INavigatorContentService) part .getAdapter(INavigatorContentService.class); if (contentService != null) { labelProvider = contentService.createCommonLabelProvider(); descriptionProvider = contentService .createCommonDescriptionProvider(); } else { WorkbenchNavigatorPlugin.log( "Could not acquire INavigatorContentService from part (\"" //$NON-NLS-1$ + part.getTitle() + "\").", null); //$NON-NLS-1$ } }
Example #2
Source File: TabbedPropertySheetTitleProvider.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
/** * Constructor for CommonNavigatorTitleProvider. */ public TabbedPropertySheetTitleProvider() { super(); IWorkbenchPart part = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage().findView(ProjectExplorer.VIEW_ID); INavigatorContentService contentService = (INavigatorContentService) part .getAdapter(INavigatorContentService.class); if (contentService != null) { labelProvider = contentService.createCommonLabelProvider(); descriptionProvider = contentService .createCommonDescriptionProvider(); } else { WorkbenchNavigatorPlugin.log( "Could not acquire INavigatorContentService from part (\"" //$NON-NLS-1$ + part.getTitle() + "\").", null); //$NON-NLS-1$ } }
Example #3
Source File: BugContentProvider.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
public static BugContentProvider getProvider(INavigatorContentService service) { INavigatorContentExtension extensionById = service.getContentExtensionById(FindbugsPlugin.BUG_CONTENT_PROVIDER_ID); IContentProvider provider = extensionById.getContentProvider(); if (provider instanceof BugContentProvider) { return (BugContentProvider) provider; } return null; }
Example #4
Source File: PythonBaseModelProvider.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * @return whether there are children for the given element. Note that there is * an optimization in this method, so that it works correctly for elements that * are not python files, and returns true if it is a python file with any content * (even if that content does not actually map to a node. * * @see org.eclipse.ui.model.BaseWorkbenchContentProvider#hasChildren(java.lang.Object) */ @Override public boolean hasChildren(Object element) { if (element instanceof PythonFile) { //If we're not showing nodes, return false. INavigatorContentService contentService = viewer.getNavigatorContentService(); INavigatorFilterService filterService = contentService.getFilterService(); ViewerFilter[] visibleFilters = filterService.getVisibleFilters(true); for (ViewerFilter viewerFilter : visibleFilters) { if (viewerFilter instanceof PythonNodeFilter) { return false; } } PythonFile f = (PythonFile) element; if (PythonPathHelper.isValidSourceFile(f.getActualObject())) { try { InputStream contents = f.getContents(); try { if (contents.read() == -1) { return false; //if there is no content in the file, it has no children } else { return true; //if it has any content, it has children (performance reasons) } } finally { contents.close(); } } catch (Exception e) { Log.log("Handled error getting contents.", e); return false; } } return false; } if (element instanceof TreeNode<?>) { TreeNode<?> treeNode = (TreeNode<?>) element; return treeNode.hasChildren(); } return getChildren(element).length > 0; }
Example #5
Source File: PydevPackageExplorer.java From Pydev with Eclipse Public License 1.0 | 4 votes |
public PydevNavigatorDnDService(INavigatorContentService aContentService) { super(aContentService); pyContentService = aContentService; }