/** * Fetches a translated string from the resource locator using the message key and the give substitutions, if any. * @param resourceLocator * @param key * @param substitutions * @return the translated string for the message key. */ protected String getString(ResourceLocator resourceLocator, String key, Object... substitutions) { return substitutions == null ? resourceLocator.getString(key) : resourceLocator.getString(key, substitutions); }
/** * Get a translated string from the resource locator, substituting two * other such translated strings. */ protected String getString(String key, String s0, String s1, boolean translate) { ResourceLocator resourceLocator = getResourceLocator(); return resourceLocator.getString(key, new Object[] { resourceLocator.getString(s0, translate), resourceLocator.getString(s1, translate) }, translate); }
/** * Get a translated string from the resource locator, substituting another * such translated string. */ protected String getString(String key, String s0, boolean translate) { ResourceLocator resourceLocator = getResourceLocator(); return resourceLocator.getString(key, new Object[] { resourceLocator.getString(s0, translate) }, translate); }
/** * Returns a translated message with the given substitutions. * The {@link #getResourceLocator() resource locator} is used. * @param key the key for the message. * @param substitutions the substitutions for the key; <code>null</code> if there are no substitutions. * @return the message. * @since 2.4 */ protected String getString(String key, Object [] substitutions) { ResourceLocator resourceLocator = getResourceLocator(); return substitutions == null ? resourceLocator.getString(key) : resourceLocator.getString(key, substitutions); }
/** * Returns a translated message with the given substitutions. * The {@link #getResourceLocator() resource locator} is used. * @param key the key for the message. * @param substitutions the substitutions for the key; <code>null</code> if there are no substitutions. * @return the message. * @since 2.4 */ protected String getString(String key, Object [] substitutions) { ResourceLocator resourceLocator = getResourceLocator(); return substitutions == null ? resourceLocator.getString(key) : resourceLocator.getString(key, substitutions); }
/** * Get a translated string from the resource locator. */ public String getString(String key, boolean translate) { return getResourceLocator().getString(key, translate); }
/** * Get a translated string from the resource locator, with substitutions. */ public String getString(String key, Object [] substitutions, boolean translate) { return getResourceLocator().getString(key, substitutions, translate); }
/** * This looks up the name of the specified feature. */ protected String getFeatureText(Object feature) { String featureKey; if (feature instanceof EStructuralFeature) { EStructuralFeature eFeature = (EStructuralFeature)feature; featureKey = eFeature.getEContainingClass().getName() + "_" + eFeature.getName(); } else { featureKey = "Unknown"; } return getResourceLocator().getString("_UI_" + featureKey + "_feature"); }
public String getString(String key, boolean translate) { Map<String, String> stringMap = translate ? strings : untranslatedStrings; String result = stringMap.get(key); if (result == null) { try { ResourceLocator pluginResourceLocator = getPrimaryResourceLocator(); if (pluginResourceLocator == null) { result = doGetString(key, translate); } else { result = pluginResourceLocator.getString(key, translate); } } catch (MissingResourceException exception) { result = delegatedGetString(key, translate); } stringMap.put(key, result); } return result; }
protected void reportDataValuePatternViolation (EDataType eDataType, Object value, PatternMatcher [] patterns, DiagnosticChain diagnostics, Map<Object, Object> context) { String patternLiterals = ""; if (patterns.length > 0) { patternLiterals = getEcoreResourceLocator().getString("_UI_ListHead_composition", new Object [] { patterns[0] }); for (int i = 1; i < patterns.length; ++i) { patternLiterals = getEcoreResourceLocator().getString("_UI_ListTail_composition", new Object [] { patternLiterals, patterns[i] }); } } diagnostics.add (createDiagnostic (Diagnostic.ERROR, DIAGNOSTIC_SOURCE, DATA_VALUE__MATCHES_PATTERN, "_UI_PatternConstraint_diagnostic", new Object [] { getValueLabel(eDataType, value, context), patternLiterals }, new Object [] { value, eDataType, patterns }, context)); }
protected void reportDataValuePatternViolation (EDataType eDataType, Object value, PatternMatcher [] patterns, DiagnosticChain diagnostics, Map<Object, Object> context) { String patternLiterals = ""; if (patterns.length > 0) { patternLiterals = getEcoreResourceLocator().getString("_UI_ListHead_composition", new Object [] { patterns[0] }); for (int i = 1; i < patterns.length; ++i) { patternLiterals = getEcoreResourceLocator().getString("_UI_ListTail_composition", new Object [] { patternLiterals, patterns[i] }); } } diagnostics.add (createDiagnostic (Diagnostic.ERROR, DIAGNOSTIC_SOURCE, DATA_VALUE__MATCHES_PATTERN, "_UI_PatternConstraint_diagnostic", new Object [] { getValueLabel(eDataType, value, context), patternLiterals }, new Object [] { value, eDataType, patterns }, context)); }
/** */ @Override protected String getFeatureText(Object feature) { String text = feature instanceof EStructuralFeature ? ((EStructuralFeature)feature).getName() : getResourceLocator().getString("_UI_Unknown_feature"); return format(capName(text), ' '); }
/** * This looks up the name of the type of the specified object. */ protected String getTypeText(Object object) { if (object instanceof EObject) { EObject eObject = ((EObject)object); String typeKey = eObject.eClass().getName(); List<Adapter> originalAdapters = new ArrayList<Adapter>(eObject.eAdapters()); try { return getResourceLocator(object).getString("_UI_" + typeKey + "_type"); } catch (MissingResourceException e) { return typeKey; } finally { eObject.eAdapters().retainAll(originalAdapters); } } return getString("_UI_Unknown_type"); }
/** */ @Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { // if (itemPropertyDescriptors == null) { itemPropertyDescriptors = new ArrayList<IItemPropertyDescriptor>(); for (EStructuralFeature eFeature : ((EObject)object).eClass().getEAllStructuralFeatures()) { if (!(eFeature instanceof EReference) || !((EReference)eFeature).isContainment()) { itemPropertyDescriptors.add (new ItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getFeatureText(eFeature), getResourceLocator().getString ("_UI_Property_description", new Object [] { getFeatureText(eFeature), eFeature.getEType().getName() }), eFeature, eFeature.isChangeable(), ItemPropertyDescriptor.GENERIC_VALUE_IMAGE)); } } } return itemPropertyDescriptors; }
getResourceLocator().getString (feature instanceof EAttribute ? "_UI_CreateChild_text3" : "_UI_CreateChild_text", new Object[] { childType, getFeatureText(feature), getTypeText(owner) }); getResourceLocator().getString ("_UI_CreateChild_label", new Object[] { childType, getFeatureText(feature), getTypeText(owner) });
@Override public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) { if (feature instanceof EStructuralFeature && FeatureMapUtil.isFeatureMap((EStructuralFeature)feature)) { FeatureMap.Entry entry = (FeatureMap.Entry)child; feature = entry.getEStructuralFeature(); child = entry.getValue(); } String childType = feature instanceof EAttribute ? getTypeText((EAttribute)feature) : getTypeText(child); return getResourceLocator().getString ("_UI_CreateChild_text2", new Object[] { childType, getFeatureText(feature), getTypeText(owner) }); }
/** * This returns the tool tip text for {@link CreateChildCommand}. */ public String getCreateChildToolTipText(Object owner, Object feature, Object child, Collection<?> selection) { if (feature instanceof EStructuralFeature && FeatureMapUtil.isFeatureMap((EStructuralFeature)feature)) { FeatureMap.Entry entry = (FeatureMap.Entry)child; feature = entry.getEStructuralFeature(); child = entry.getValue(); } String childType = feature instanceof EAttribute ? getTypeText((EAttribute)feature) : getTypeText(child); return getResourceLocator().getString ("_UI_CreateChild_tooltip", new Object[] {childType , getFeatureText(feature), getTypeText(owner) }); }