Search in sources :

Example 1 with NavigatorContentService

use of org.eclipse.ui.internal.navigator.NavigatorContentService in project liferay-ide by liferay.

the class PortletResourcesContentProvider method refresh.

public void refresh() {
    NavigatorContentService s = (NavigatorContentService) getConfig().getService();
    Runnable runnable = new Runnable() {

        public void run() {
            try {
                CommonViewer viewer = (CommonViewer) s.getViewer();
                TreePath[] paths = viewer.getExpandedTreePaths();
                viewer.refresh(true);
                viewer.setExpandedTreePaths(paths);
            } catch (Exception e) {
            }
        }
    };
    UIUtil.sync(runnable);
}
Also used : NavigatorContentService(org.eclipse.ui.internal.navigator.NavigatorContentService) TreePath(org.eclipse.jface.viewers.TreePath) CommonViewer(org.eclipse.ui.navigator.CommonViewer)

Example 2 with NavigatorContentService

use of org.eclipse.ui.internal.navigator.NavigatorContentService in project translationstudio8 by heartsome.

the class WorkingSetsContentProvider method init.

/* (non-Javadoc)
	 * @see org.eclipse.ui.navigator.ICommonContentProvider#init(org.eclipse.ui.navigator.ICommonContentExtensionSite)
	 */
public void init(ICommonContentExtensionSite aConfig) {
    NavigatorContentService cs = (NavigatorContentService) aConfig.getService();
    viewer = (CommonViewer) cs.getViewer();
    projectExplorer = viewer.getCommonNavigator();
    extensionStateModel = aConfig.getExtensionStateModel();
    extensionStateModel.addPropertyChangeListener(rootModeListener);
    updateRootMode();
}
Also used : NavigatorContentService(org.eclipse.ui.internal.navigator.NavigatorContentService)

Example 3 with NavigatorContentService

use of org.eclipse.ui.internal.navigator.NavigatorContentService in project tmdm-studio-se by Talend.

the class MDMNavigatorDecoratingLabelProvider method getToolTipText.

@Override
public String getToolTipText(Object element) {
    if (getViewer() instanceof CommonViewer) {
        CommonViewer viewer = (CommonViewer) getViewer();
        INavigatorContentService contentService = viewer.getNavigatorContentService();
        if (contentService != null && contentService instanceof NavigatorContentService) {
            Collection<?> contentExtensions = ((NavigatorContentService) contentService).findPossibleLabelExtensions(element);
            for (Iterator<?> itr = contentExtensions.iterator(); itr.hasNext(); ) {
                Object extension = itr.next();
                if (extension instanceof NavigatorContentExtension) {
                    ICommonLabelProvider provider = ((NavigatorContentExtension) extension).getLabelProvider();
                    if (provider instanceof CellLabelProvider) {
                        String toolTipText = ((CellLabelProvider) provider).getToolTipText(element);
                        if (toolTipText != null) {
                            return toolTipText;
                        }
                    }
                }
            }
        }
    }
    return super.getToolTipText(element);
}
Also used : INavigatorContentService(org.eclipse.ui.navigator.INavigatorContentService) NavigatorContentService(org.eclipse.ui.internal.navigator.NavigatorContentService) NavigatorContentExtension(org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension) CommonViewer(org.eclipse.ui.navigator.CommonViewer) ICommonLabelProvider(org.eclipse.ui.navigator.ICommonLabelProvider) INavigatorContentService(org.eclipse.ui.navigator.INavigatorContentService) CellLabelProvider(org.eclipse.jface.viewers.CellLabelProvider)

Example 4 with NavigatorContentService

use of org.eclipse.ui.internal.navigator.NavigatorContentService in project liferay-ide by liferay.

the class UIUtil method refreshContent.

public static void refreshContent(ICommonContentExtensionSite site, Object elementOrTreePath) {
    NavigatorContentService s = (NavigatorContentService) site.getService();
    sync(new Runnable() {

        public void run() {
            try {
                CommonViewer viewer = (CommonViewer) s.getViewer();
                viewer.refresh(true);
                viewer.setExpandedState(elementOrTreePath, true);
            } catch (Exception e) {
            }
        }
    });
}
Also used : NavigatorContentService(org.eclipse.ui.internal.navigator.NavigatorContentService) CommonViewer(org.eclipse.ui.navigator.CommonViewer) NotDefinedException(org.eclipse.core.commands.common.NotDefinedException) PartInitException(org.eclipse.ui.PartInitException) NotEnabledException(org.eclipse.core.commands.NotEnabledException) NotHandledException(org.eclipse.core.commands.NotHandledException) IOException(java.io.IOException) ExecutionException(org.eclipse.core.commands.ExecutionException)

Aggregations

NavigatorContentService (org.eclipse.ui.internal.navigator.NavigatorContentService)4 CommonViewer (org.eclipse.ui.navigator.CommonViewer)3 IOException (java.io.IOException)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 NotEnabledException (org.eclipse.core.commands.NotEnabledException)1 NotHandledException (org.eclipse.core.commands.NotHandledException)1 NotDefinedException (org.eclipse.core.commands.common.NotDefinedException)1 CellLabelProvider (org.eclipse.jface.viewers.CellLabelProvider)1 TreePath (org.eclipse.jface.viewers.TreePath)1 PartInitException (org.eclipse.ui.PartInitException)1 NavigatorContentExtension (org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension)1 ICommonLabelProvider (org.eclipse.ui.navigator.ICommonLabelProvider)1 INavigatorContentService (org.eclipse.ui.navigator.INavigatorContentService)1