use of org.eclipse.ui.navigator.CommonNavigator 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));
}
}
use of org.eclipse.ui.navigator.CommonNavigator in project tdq-studio-se by Talend.
the class RepositoryNodeHelper method getDQCommonViewer.
/**
* DOC klliu 15750 Comment method "getDQRespositoryView".
*
* @return
*/
public static CommonViewer getDQCommonViewer() {
IViewPart part = null;
CommonViewer commonViewer = null;
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (activeWorkbenchWindow != null) {
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
if (activePage != null) {
part = activePage.findView(DQRESPOSITORYVIEW);
if (part == null) {
return null;
}
CommonNavigator dqView = (CommonNavigator) part;
commonViewer = dqView.getCommonViewer();
}
}
return commonViewer;
}
use of org.eclipse.ui.navigator.CommonNavigator in project abstools by abstools.
the class ActionUtils method getSelectedResourceOrNull.
private static IResource getSelectedResourceOrNull(IWorkbenchWindow window) throws PartInitException {
CommonNavigator explorer = (CommonNavigator) window.getActivePage().showView(IPageLayout.ID_PROJECT_EXPLORER);
Object e = ((StructuredSelection) explorer.getCommonViewer().getSelection()).getFirstElement();
if (e instanceof IResource)
return (IResource) e;
return null;
}
use of org.eclipse.ui.navigator.CommonNavigator in project tmdm-studio-se by Talend.
the class DeployOnMDMAction method refreshMdmRepositoryViewTree.
/**
* If the MDM Repository View is showing,refresh the navigator tree in it.
*/
private void refreshMdmRepositoryViewTree() {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
// $NON-NLS-1$
IViewPart mdmRepositoryView = activePage.findView("org.talend.mdm.repository.ui.navigator.MDMRepositoryView");
if (mdmRepositoryView instanceof CommonNavigator) {
CommonNavigator cNavigator = (CommonNavigator) mdmRepositoryView;
cNavigator.getCommonViewer().refresh();
}
}
use of org.eclipse.ui.navigator.CommonNavigator in project tbd-studio-se by Talend.
the class MetadataHadoopClusterContentProvider method addResourceVisitor.
/*
* (non-Javadoc)
*
* @see
* org.talend.repository.viewer.content.FolderListenerSingleTopContentProvider#addResourceVisitor(org.eclipse.ui
* .navigator.CommonViewer)
*/
@Override
protected void addResourceVisitor(CommonViewer v) {
// super.addResourceVisitor(v);
if (v == null) {
return;
}
RepoViewCommonNavigator navigator = null;
if (v instanceof RepoViewCommonViewer) {
CommonNavigator commonNavigator = ((RepoViewCommonViewer) v).getCommonNavigator();
if (commonNavigator instanceof RepoViewCommonNavigator) {
navigator = ((RepoViewCommonNavigator) commonNavigator);
}
}
if (navigator == null) {
return;
}
if (this.testVisitor != null) {
navigator.removeVisitor(this.testVisitor);
}
this.testVisitor = new MetadataHadoopClusterChildrenNodeVisitor();
navigator.addVisitor(this.testVisitor);
}
Aggregations