Search in sources :

Example 1 with IAggregateWorkingSet

use of org.eclipse.ui.IAggregateWorkingSet in project translationstudio8 by heartsome.

the class ProjectExplorer method updateTitle.

/**
	 * The superclass does not deal with the content description, handle it
	 * here.
	 * 
	 * @noreference
	 */
public void updateTitle() {
    super.updateTitle();
    Object input = getCommonViewer().getInput();
    if (input == null || input instanceof IAggregateWorkingSet) {
        //$NON-NLS-1$
        setContentDescription("");
        return;
    }
    if (!(input instanceof IResource)) {
        if (input instanceof IAdaptable) {
            IWorkbenchAdapter wbadapter = (IWorkbenchAdapter) ((IAdaptable) input).getAdapter(IWorkbenchAdapter.class);
            if (wbadapter != null) {
                setContentDescription(wbadapter.getLabel(input));
                return;
            }
        }
        setContentDescription(input.toString());
        return;
    }
    IResource res = (IResource) input;
    setContentDescription(res.getName());
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) IAggregateWorkingSet(org.eclipse.ui.IAggregateWorkingSet) IWorkbenchAdapter(org.eclipse.ui.model.IWorkbenchAdapter) IResource(org.eclipse.core.resources.IResource)

Example 2 with IAggregateWorkingSet

use of org.eclipse.ui.IAggregateWorkingSet 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)

Aggregations

IResource (org.eclipse.core.resources.IResource)2 IAggregateWorkingSet (org.eclipse.ui.IAggregateWorkingSet)2 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 IPath (org.eclipse.core.runtime.IPath)1 IWorkingSet (org.eclipse.ui.IWorkingSet)1 Frame (org.eclipse.ui.internal.navigator.framelist.Frame)1 FrameList (org.eclipse.ui.internal.navigator.framelist.FrameList)1 TreeFrame (org.eclipse.ui.internal.navigator.framelist.TreeFrame)1 IWorkbenchAdapter (org.eclipse.ui.model.IWorkbenchAdapter)1