use of org.eclipse.ui.navigator.INavigatorFilterService in project polymap4-core by Polymap4.
the class CommonFiltersTab method updateFiltersCheckState.
private void updateFiltersCheckState() {
Object[] children = filterContentProvider.getElements(getContentService());
ICommonFilterDescriptor filterDescriptor;
INavigatorFilterService filterService = getContentService().getFilterService();
for (int i = 0; i < children.length; i++) {
filterDescriptor = (ICommonFilterDescriptor) children[i];
if (filterService.isActive(filterDescriptor.getId())) {
getTableViewer().setChecked(children[i], true);
getCheckedItems().add(children[i]);
} else {
getTableViewer().setChecked(children[i], false);
}
}
}
use of org.eclipse.ui.navigator.INavigatorFilterService in project liferay-ide by liferay.
the class ProjectExplorerLayoutUtil method _execute.
private static void _execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPart part = HandlerUtil.getActivePart(event);
String nestedProjectsContentProviderExtensionId = "org.eclipse.ui.navigator.resources.nested.nestedProjectContentProvider";
String hideTopLevelProjectIfNested = "org.eclipse.ui.navigator.resources.nested.HideTopLevelProjectIfNested";
String hideFolderWhenProjectIsShownAsNested = "org.eclipse.ui.navigator.resources.nested.HideFolderWhenProjectIsShownAsNested";
if (part instanceof CommonNavigator) {
CommonNavigator navigator = (CommonNavigator) part;
INavigatorContentService navigatorContentService = navigator.getNavigatorContentService();
boolean previousNest = navigatorContentService.getActivationService().isNavigatorExtensionActive(nestedProjectsContentProviderExtensionId);
String newNestParam = event.getParameter(_nestParameter);
boolean newNest = false;
if (newNestParam != null) {
newNest = Boolean.parseBoolean(newNestParam);
}
if (newNest != previousNest) {
ISelection initialSelection = navigator.getCommonViewer().getSelection();
INavigatorFilterService filterService = navigatorContentService.getFilterService();
Set<String> filters = new HashSet<>();
for (ICommonFilterDescriptor desc : filterService.getVisibleFilterDescriptors()) {
if (filterService.isActive(desc.getId())) {
filters.add(desc.getId());
}
}
if (newNest) {
navigatorContentService.getActivationService().activateExtensions(new String[] { nestedProjectsContentProviderExtensionId }, false);
filters.add(hideTopLevelProjectIfNested);
filters.add(hideFolderWhenProjectIsShownAsNested);
} else {
navigatorContentService.getActivationService().deactivateExtensions(new String[] { nestedProjectsContentProviderExtensionId }, false);
filters.remove(hideTopLevelProjectIfNested);
filters.remove(hideFolderWhenProjectIsShownAsNested);
}
filterService.activateFilterIdsAndUpdateViewer(filters.toArray(new String[filters.size()]));
navigatorContentService.getActivationService().persistExtensionActivations();
navigator.getCommonViewer().refresh();
navigator.getCommonViewer().setSelection(initialSelection);
}
HandlerUtil.updateRadioState(event.getCommand(), Boolean.toString(newNest));
}
}
Aggregations