提交 fc4ceeeb 编写于 作者: S serge-rider

Multi-language support (model)

上级 87a16d99
...@@ -18,6 +18,7 @@ package org.jkiss.dbeaver.registry.language; ...@@ -18,6 +18,7 @@ package org.jkiss.dbeaver.registry.language;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
import org.jkiss.code.NotNull; import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.DBPNamedObjectLocalized;
import org.jkiss.dbeaver.model.app.DBPPlatformLanguage; import org.jkiss.dbeaver.model.app.DBPPlatformLanguage;
import org.jkiss.dbeaver.model.impl.AbstractContextDescriptor; import org.jkiss.dbeaver.model.impl.AbstractContextDescriptor;
import org.jkiss.dbeaver.registry.RegistryConstants; import org.jkiss.dbeaver.registry.RegistryConstants;
...@@ -25,44 +26,47 @@ import org.jkiss.dbeaver.registry.RegistryConstants; ...@@ -25,44 +26,47 @@ import org.jkiss.dbeaver.registry.RegistryConstants;
/** /**
* PlatformLanguageDescriptor * PlatformLanguageDescriptor
*/ */
public class PlatformLanguageDescriptor extends AbstractContextDescriptor implements DBPPlatformLanguage public class PlatformLanguageDescriptor extends AbstractContextDescriptor implements DBPPlatformLanguage, DBPNamedObjectLocalized {
{
public static final String EXTENSION_ID = "org.jkiss.dbeaver.language"; //$NON-NLS-1$ public static final String EXTENSION_ID = "org.jkiss.dbeaver.language"; //$NON-NLS-1$
private final String code; private final IConfigurationElement config;
private final String label;
private final String description;
public PlatformLanguageDescriptor( public PlatformLanguageDescriptor(IConfigurationElement config) {
IConfigurationElement config)
{
super(config); super(config);
this.code = config.getAttribute(RegistryConstants.ATTR_CODE); this.config = config;
this.label = config.getAttribute(RegistryConstants.ATTR_LABEL);
this.description = config.getAttribute(RegistryConstants.ATTR_DESCRIPTION);
} }
@NotNull @NotNull
@Override @Override
public String getCode() { public String getCode() {
return code; return config.getAttribute(RegistryConstants.ATTR_CODE);
} }
@NotNull @NotNull
@Override @Override
public String getLabel() public String getLabel() {
{ return config.getAttribute(RegistryConstants.ATTR_LABEL);
return label;
} }
public String getDescription() public String getDescription() {
{ return config.getAttribute(RegistryConstants.ATTR_DESCRIPTION);
return description;
} }
@Override @Override
public String toString() { public String toString() {
return code; return getCode();
} }
@NotNull
@Override
public String getName() {
return getLabel();
}
@Override
public String getLocalizedName(String locale) {
return config.getAttribute(RegistryConstants.ATTR_LABEL, locale);
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册