| /******************************************************************************* |
| * 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, |
| * Olivier L. Larouche - initial API and implementation |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| * |
| *******************************************************************************/ |
| package org.eclipse.apogy.core.invocator.provider; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.apogy.core.invocator.ApogyCoreInvocatorPackage; |
| import org.eclipse.apogy.core.invocator.EEnumArgument; |
| import org.eclipse.emf.common.notify.AdapterFactory; |
| import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; |
| import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; |
| |
| public class EEnumArgumentCustomItemProvider extends EEnumArgumentItemProvider { |
| public EEnumArgumentCustomItemProvider(AdapterFactory adapterFactory) { |
| super(adapterFactory); |
| } |
| |
| // FIXME Item provider not required anymore. |
| |
| @Override |
| protected void addEEnumLiteralPropertyDescriptor(Object object) { |
| this.itemPropertyDescriptors.add(new ItemPropertyDescriptor( |
| ((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), getResourceLocator(), |
| getString("_UI_EEnumArgument_eEnumLiteral_feature"), |
| getString("_UI_PropertyDescriptor_description", "_UI_EEnumArgument_eEnumLiteral_feature", |
| "_UI_EEnumArgument_type"), |
| ApogyCoreInvocatorPackage.Literals.EENUM_ARGUMENT__EENUM_LITERAL, true, false, true, null, null, null) { |
| @Override |
| protected Collection<?> getComboBoxObjects(Object object) { |
| EEnumArgument eEnumArgument = (EEnumArgument) object; |
| return eEnumArgument.getEEnum().getELiterals(); |
| } |
| }); |
| } |
| |
| @Override |
| public String getText(Object object) { |
| EEnumArgument argument = (EEnumArgument) object; |
| String label = super.getText(object); |
| |
| if (argument.getEEnumLiteral() != null) { |
| label += " (" + argument.getEEnumLiteral().getName() + ")"; |
| } else { |
| label += " (null)"; |
| } |
| |
| return label; |
| } |
| } |