Search in sources :

Example 1 with FrameList

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

the class ProjectExplorer method getFrameToolTipText.

/**
	 * Returns the tool tip text for the given element.
	 * 
	 * @param element
	 *            the element
	 * @return the tooltip
	 * @noreference
	 */
public String getFrameToolTipText(Object element) {
    String result;
    if (!(element instanceof IResource)) {
        if (element instanceof IAggregateWorkingSet) {
            result = WorkbenchNavigatorMessages.resources_ProjectExplorerPart_workingSetModel;
        } else if (element instanceof IWorkingSet) {
            result = ((IWorkingSet) element).getLabel();
        } else {
            result = super.getFrameToolTipText(element);
        }
    } else {
        IPath path = ((IResource) element).getFullPath();
        if (path.isRoot()) {
            result = WorkbenchNavigatorMessages.resources_ProjectExplorerPart_workspace;
        } else {
            result = path.makeRelative().toString();
        }
    }
    if (rootMode == PROJECTS) {
        if (workingSetLabel == null)
            return result;
        if (result.length() == 0)
            return NLS.bind(WorkbenchNavigatorMessages.resources_ProjectExplorer_toolTip, new String[] { workingSetLabel });
        return NLS.bind(WorkbenchNavigatorMessages.resources_ProjectExplorer_toolTip2, new String[] { result, workingSetLabel });
    }
    // be null.
    if (element != null && !(element instanceof IWorkingSet) && getCommonViewer() != null) {
        FrameList frameList = getCommonViewer().getFrameList();
        // Happens during initialization
        if (frameList == null)
            return result;
        int index = frameList.getCurrentIndex();
        IWorkingSet ws = null;
        while (index >= 0) {
            Frame frame = frameList.getFrame(index);
            if (frame instanceof TreeFrame) {
                Object input = ((TreeFrame) frame).getInput();
                if (input instanceof IWorkingSet && !(input instanceof IAggregateWorkingSet)) {
                    ws = (IWorkingSet) input;
                    break;
                }
            }
            index--;
        }
        if (ws != null) {
            return NLS.bind(WorkbenchNavigatorMessages.resources_ProjectExplorer_toolTip3, new String[] { ws.getLabel(), result });
        }
        return result;
    }
    return result;
}
Also used : TreeFrame(org.eclipse.ui.internal.navigator.framelist.TreeFrame) Frame(org.eclipse.ui.internal.navigator.framelist.Frame) IPath(org.eclipse.core.runtime.IPath) IAggregateWorkingSet(org.eclipse.ui.IAggregateWorkingSet) FrameList(org.eclipse.ui.internal.navigator.framelist.FrameList) TreeFrame(org.eclipse.ui.internal.navigator.framelist.TreeFrame) IResource(org.eclipse.core.resources.IResource) IWorkingSet(org.eclipse.ui.IWorkingSet)

Example 2 with FrameList

use of org.eclipse.ui.internal.navigator.framelist.FrameList in project polymap4-core by Polymap4.

the class CommonViewer method createFrameList.

/**
 * @noreference This method is not intended to be referenced by clients.
 * @nooverride This method is not intended to be re-implemented or extended by clients.
 * @since 3.4
 */
public void createFrameList() {
    CommonNavigatorFrameSource frameSource = new CommonNavigatorFrameSource(commonNavigator);
    frameList = new FrameList(frameSource);
    frameSource.connectTo(frameList);
}
Also used : CommonNavigatorFrameSource(org.eclipse.ui.internal.navigator.CommonNavigatorFrameSource) FrameList(org.eclipse.ui.internal.navigator.framelist.FrameList)

Example 3 with FrameList

use of org.eclipse.ui.internal.navigator.framelist.FrameList in project polymap4-core by Polymap4.

the class CommonNavigatorActionGroup method makeActions.

/**
 */
private void makeActions() {
    FrameList frameList = commonViewer.getFrameList();
    backAction = new BackAction(frameList);
    forwardAction = new ForwardAction(frameList);
    upAction = new UpAction(frameList);
    frameList.addPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals(FrameList.P_RESET)) {
                upAction.setEnabled(false);
                backAction.setEnabled(false);
                forwardAction.setEnabled(false);
            }
            commonNavigator.updateTitle();
            IActionBars actionBars = commonNavigator.getViewSite().getActionBars();
            updateToolBar(actionBars.getToolBarManager());
        }
    });
    IHandlerService service = (IHandlerService) commonNavigator.getSite().getService(IHandlerService.class);
    INavigatorViewerDescriptor viewerDescriptor = commonViewer.getNavigatorContentService().getViewerDescriptor();
    boolean hideLinkWithEditorAction = viewerDescriptor.getBooleanConfigProperty(INavigatorViewerDescriptor.PROP_HIDE_LINK_WITH_EDITOR_ACTION);
    if (!hideLinkWithEditorAction) {
        toggleLinkingAction = new LinkEditorAction(commonNavigator, commonViewer, linkHelperService);
        // $NON-NLS-1$
        ImageDescriptor syncIcon = getImageDescriptor("elcl16/synced.gif");
        toggleLinkingAction.setImageDescriptor(syncIcon);
        toggleLinkingAction.setHoverImageDescriptor(syncIcon);
        service.activateHandler(toggleLinkingAction.getActionDefinitionId(), new ActionHandler(toggleLinkingAction));
    }
    boolean hideCollapseAllAction = viewerDescriptor.getBooleanConfigProperty(INavigatorViewerDescriptor.PROP_HIDE_COLLAPSE_ALL_ACTION);
    if (!hideCollapseAllAction) {
        collapseAllAction = new CollapseAllAction(commonViewer);
        // $NON-NLS-1$
        ImageDescriptor collapseAllIcon = getImageDescriptor("elcl16/collapseall.gif");
        collapseAllAction.setImageDescriptor(collapseAllIcon);
        collapseAllAction.setHoverImageDescriptor(collapseAllIcon);
        collapseAllHandler = new CollapseAllHandler(commonViewer);
        service.activateHandler(CollapseAllHandler.COMMAND_ID, collapseAllHandler);
    }
    filterGroup = new FilterActionGroup(commonViewer);
}
Also used : IPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) UpAction(org.eclipse.ui.internal.navigator.framelist.UpAction) FrameList(org.eclipse.ui.internal.navigator.framelist.FrameList) CollapseAllHandler(org.eclipse.ui.handlers.CollapseAllHandler) LinkEditorAction(org.eclipse.ui.internal.navigator.actions.LinkEditorAction) INavigatorViewerDescriptor(org.eclipse.ui.navigator.INavigatorViewerDescriptor) FilterActionGroup(org.eclipse.ui.internal.navigator.filters.FilterActionGroup) IHandlerService(org.eclipse.ui.handlers.IHandlerService) CollapseAllAction(org.eclipse.ui.internal.navigator.actions.CollapseAllAction) ForwardAction(org.eclipse.ui.internal.navigator.framelist.ForwardAction) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) BackAction(org.eclipse.ui.internal.navigator.framelist.BackAction) ActionHandler(org.eclipse.jface.commands.ActionHandler) IActionBars(org.eclipse.ui.IActionBars)

Aggregations

FrameList (org.eclipse.ui.internal.navigator.framelist.FrameList)3 IResource (org.eclipse.core.resources.IResource)1 IPath (org.eclipse.core.runtime.IPath)1 ActionHandler (org.eclipse.jface.commands.ActionHandler)1 ImageDescriptor (org.eclipse.jface.resource.ImageDescriptor)1 IPropertyChangeListener (org.eclipse.jface.util.IPropertyChangeListener)1 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)1 IActionBars (org.eclipse.ui.IActionBars)1 IAggregateWorkingSet (org.eclipse.ui.IAggregateWorkingSet)1 IWorkingSet (org.eclipse.ui.IWorkingSet)1 CollapseAllHandler (org.eclipse.ui.handlers.CollapseAllHandler)1 IHandlerService (org.eclipse.ui.handlers.IHandlerService)1 CommonNavigatorFrameSource (org.eclipse.ui.internal.navigator.CommonNavigatorFrameSource)1 CollapseAllAction (org.eclipse.ui.internal.navigator.actions.CollapseAllAction)1 LinkEditorAction (org.eclipse.ui.internal.navigator.actions.LinkEditorAction)1 FilterActionGroup (org.eclipse.ui.internal.navigator.filters.FilterActionGroup)1 BackAction (org.eclipse.ui.internal.navigator.framelist.BackAction)1 ForwardAction (org.eclipse.ui.internal.navigator.framelist.ForwardAction)1 Frame (org.eclipse.ui.internal.navigator.framelist.Frame)1 TreeFrame (org.eclipse.ui.internal.navigator.framelist.TreeFrame)1