|
Lines 4-53
Link Here
|
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
|
|
| 8 |
* Contributors: |
7 |
* Contributors: |
| 9 |
* Eike Stepper - initial API and implementation |
8 |
* Eike Stepper - initial API and implementation |
| 10 |
*/ |
9 |
*/ |
| 11 |
package org.eclipse.emf.ecp.ui.model; |
10 |
package org.eclipse.emf.ecp.ui.model; |
| 12 |
|
11 |
|
| 13 |
import org.eclipse.emf.ecp.core.ECPRepository; |
12 |
import org.eclipse.emf.ecp.core.ECPRepository; |
| 14 |
import org.eclipse.emf.ecp.core.util.ECPModelContextProvider; |
13 |
import org.eclipse.emf.ecp.core.util.ECPModelContextProvider; |
| 15 |
import org.eclipse.emf.ecp.internal.ui.Activator; |
|
|
| 16 |
|
| 17 |
import org.eclipse.swt.graphics.Image; |
| 18 |
|
14 |
|
| 19 |
/** |
15 |
/** |
| 20 |
* @author Eike Stepper |
16 |
* @author Eike Stepper |
| 21 |
*/ |
17 |
*/ |
| 22 |
public class RepositoriesLabelProvider extends ECPLabelProvider |
18 |
public class RepositoriesLabelProvider extends ECPLabelProvider { |
| 23 |
{ |
|
|
| 24 |
private static final Image REPOSITORY = Activator.getImage("icons/repository.gif"); //$NON-NLS-1$ |
| 25 |
|
19 |
|
| 26 |
public RepositoriesLabelProvider(ECPModelContextProvider modelContextProvider) |
20 |
public RepositoriesLabelProvider(ECPModelContextProvider modelContextProvider) { |
| 27 |
{ |
21 |
super(modelContextProvider); |
| 28 |
super(modelContextProvider); |
22 |
} |
| 29 |
} |
|
|
| 30 |
|
23 |
|
| 31 |
@Override |
24 |
@Override |
| 32 |
public String getText(Object element) |
25 |
public String getText(Object element) { |
| 33 |
{ |
26 |
if (element instanceof ECPRepository) { |
| 34 |
if (element instanceof ECPRepository) |
27 |
ECPRepository repository = (ECPRepository) element; |
| 35 |
{ |
28 |
return repository.getLabel(); |
| 36 |
ECPRepository repository = (ECPRepository)element; |
29 |
} |
| 37 |
return repository.getLabel(); |
|
|
| 38 |
} |
| 39 |
|
30 |
|
| 40 |
return super.getText(element); |
31 |
return super.getText(element); |
| 41 |
} |
32 |
} |
| 42 |
|
|
|
| 43 |
@Override |
| 44 |
public Image getImage(Object element) |
| 45 |
{ |
| 46 |
if (element instanceof ECPRepository) |
| 47 |
{ |
| 48 |
return REPOSITORY; |
| 49 |
} |
| 50 |
|
| 51 |
return super.getImage(element); |
| 52 |
} |
| 53 |
} |
33 |
} |