blob: ed3982a21f8435f1ca32335689ba435c6e22de97 (
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
|
/**
* Copyright (c) 2016 CEA LIST, 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:
* Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
*
*/
package org.eclipse.papyrus.infra.nattable.modelexplorer.queries;
import org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager;
import org.eclipse.papyrus.emf.facet.efacet.core.exception.DerivedTypedElementException;
import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.model.nattable.provider.NattableEditPlugin;
import org.eclipse.papyrus.infra.ui.editorsfactory.AbstractGetEditorIconQuery;
/**
* Return the label of the corresponding table.
*/
public class GetTableLabel extends AbstractGetEditorIconQuery implements IJavaQuery2<Table, String> {
/**
* {@inheritDoc}
*
* @see org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2#evaluate(org.eclipse.emf.ecore.EObject, org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2, org.eclipse.papyrus.emf.facet.efacet.core.IFacetManager)
*/
public String evaluate(final Table source, final IParameterValueList2 parameterValues, final IFacetManager facetManager) throws DerivedTypedElementException {
final String label = LabelInternationalization.getInstance().getTableLabel(source);
return label == null || label.length() == 0 ? NattableEditPlugin.INSTANCE.getString("_UI_Table_type") : //$NON-NLS-1$
NattableEditPlugin.INSTANCE.getString("_UI_Table_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
}
}
|