01: /*******************************************************************************
02: * Copyright (c) 2004, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM - Initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.progress;
11:
12: import org.eclipse.jface.viewers.LabelProvider;
13: import org.eclipse.swt.widgets.Control;
14:
15: /**
16: * The ProgressViewerLabelProvider is the label provider for progress viewers.
17: */
18: public class ProgressViewerLabelProvider extends LabelProvider {
19: private Control control;
20:
21: /*
22: * (non-Javadoc)
23: *
24: * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
25: */
26: public String getText(Object element) {
27: JobTreeElement info = (JobTreeElement) element;
28: return ProgressManagerUtil.shortenText(info
29: .getCondensedDisplayString(), control);
30: }
31:
32: /**
33: * Create a new instance of the receiver within the control.
34: *
35: * @param progressControl The control that the label is
36: * being created for.
37: */
38: public ProgressViewerLabelProvider(Control progressControl) {
39: super();
40: control = progressControl;
41: }
42: }
|