| /******************************************************************************* |
| * Copyright (c) 2004-2008 Istvan Rath and Daniel Varro |
| * 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: |
| * Istvan Rath - initial API and implementation |
| *******************************************************************************/ |
| |
| package org.eclipse.viatra2.frameworkgui.content;
|
|
|
| import org.eclipse.jface.viewers.LabelProvider; |
| import org.eclipse.swt.graphics.Image; |
| import org.eclipse.ui.ISharedImages; |
| import org.eclipse.ui.PlatformUI; |
|
|
| public class FrameworkViewLabelProvider extends LabelProvider
|
| {
|
|
|
| private static Image elementImage = PlatformUI.getWorkbench()
|
| .getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT);
|
|
|
|
|
| public String getText(Object obj)
|
| {
|
| if (obj instanceof ITreeObject)
|
| {
|
| return ((ITreeObject)obj).getLabelText();
|
| }
|
| return obj.toString();
|
| }
|
|
|
| public Image getImage(Object obj) {
|
| Image ret = elementImage;
|
| if (obj instanceof ITreeObject) ret = ((ITreeObject)obj).getLabelImage();
|
| return ret!=null?ret:elementImage;
|
| }
|
| }
|