| /******************************************************************************* |
| * Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency |
| * 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: |
| * Pierre Allard, |
| * Regent L'Archeveque - initial API and implementation |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| *******************************************************************************/ |
| package org.eclipse.apogy.examples.satellite.provider; |
| |
| import org.eclipse.apogy.examples.satellite.AbstractConstellationRequest; |
| import org.eclipse.emf.common.notify.AdapterFactory; |
| import org.eclipse.emf.edit.provider.ComposedAdapterFactory; |
| import org.eclipse.emf.edit.provider.IItemLabelProvider; |
| |
| public class AbstractConstellationRequestCustomItemProvider extends AbstractConstellationRequestItemProvider { |
| private ComposedAdapterFactory composedAdapterFactory; |
| |
| public AbstractConstellationRequestCustomItemProvider(AdapterFactory adapterFactory) { |
| super(adapterFactory); |
| } |
| |
| /* |
| * Returns a singleton {@link ComposedAdapterFactory}. |
| */ |
| protected ComposedAdapterFactory getComposedAdapterFactory() { |
| if (this.composedAdapterFactory == null) { |
| this.composedAdapterFactory = new ComposedAdapterFactory( |
| ComposedAdapterFactory.Descriptor.Registry.INSTANCE); |
| } |
| return this.composedAdapterFactory; |
| } |
| |
| @Override |
| public String getText(Object object) { |
| AbstractConstellationRequest request = (AbstractConstellationRequest) object; |
| String value = "<"; |
| if (request.getUid() != null) { |
| IItemLabelProvider labelProvider = (IItemLabelProvider) getComposedAdapterFactory().adapt(request.getUid(), |
| IItemLabelProvider.class); |
| value = value + labelProvider.getText(request.getUid()); |
| } |
| value = value + ">" + getAbstractConstellationRequestTypeName(); |
| return value; |
| } |
| |
| /** |
| * This method must be overriden. |
| */ |
| public String getAbstractConstellationRequestTypeName() { |
| return getString("_UI_AbstractConstellationRequest_type"); |
| } |
| |
| } |