blob: 0b4c74f11e479fc3cb8e52e2d468844552047651 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/*******************************************************************************
* Copyright (c) 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jst.servlet.ui.project.facet;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.model.WorkbenchLabelProvider;
public class WebFragmentProjectLabelProvider extends LabelProvider {
private ILabelProvider workbenchLabelProvider = new WorkbenchLabelProvider();
private ILabelDecorator decorator = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
@Override
public Image getImage(Object o) {
Image image = workbenchLabelProvider.getImage(o);
if (o instanceof IProject) {
Image decorated = decorator.decorateImage(image, o);
if (decorated != null) {
return decorated;
}}
return image;
}
@Override
public String getText(Object o) {
if (o instanceof IProject) {
return ((IProject) o).getName();
}
return ""; //$NON-NLS-1$
}
}
|