mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Copyright must not save empty settings +review
This commit is contained in:
@@ -33,6 +33,7 @@ import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packageDependencies.DependencyValidationManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -58,11 +59,11 @@ import java.util.*;
|
||||
storages = {@Storage(file = StoragePathMacros.PROJECT_FILE),
|
||||
@Storage(file = StoragePathMacros.PROJECT_CONFIG_DIR + "/copyright/", scheme = StorageScheme.DIRECTORY_BASED,
|
||||
stateSplitter = CopyrightManager.CopyrightStateSplitter.class)})
|
||||
public class CopyrightManager extends AbstractProjectComponent implements JDOMExternalizable, PersistentStateComponent<Element> {
|
||||
public class CopyrightManager extends AbstractProjectComponent implements PersistentStateComponent<Element> {
|
||||
private static final Logger LOG = Logger.getInstance("#" + CopyrightManager.class.getName());
|
||||
@Nullable
|
||||
private CopyrightProfile myDefaultCopyright = null;
|
||||
private final LinkedHashMap<String, String> myModule2Copyrights = new LinkedHashMap<String, String>();
|
||||
private final LinkedHashMap<String, String> myModuleToCopyrights = new LinkedHashMap<String, String>();
|
||||
private final Map<String, CopyrightProfile> myCopyrights = new HashMap<String, CopyrightProfile>();
|
||||
private final Options myOptions = new Options();
|
||||
|
||||
@@ -140,64 +141,62 @@ public class CopyrightManager extends AbstractProjectComponent implements JDOMEx
|
||||
return "CopyrightManager";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(Element element) throws InvalidDataException {
|
||||
clearCopyrights();
|
||||
final Element module2copyright = element.getChild(MODULE2COPYRIGHT);
|
||||
if (module2copyright != null) {
|
||||
for (Object o : module2copyright.getChildren(ELEMENT)) {
|
||||
final Element el = (Element)o;
|
||||
final String moduleName = el.getAttributeValue(MODULE);
|
||||
final String copyrightName = el.getAttributeValue(COPYRIGHT);
|
||||
myModule2Copyrights.put(moduleName, copyrightName);
|
||||
}
|
||||
}
|
||||
for (Object o : element.getChildren(COPYRIGHT)) {
|
||||
final CopyrightProfile copyrightProfile = new CopyrightProfile();
|
||||
copyrightProfile.readExternal((Element)o);
|
||||
myCopyrights.put(copyrightProfile.getName(), copyrightProfile);
|
||||
}
|
||||
myDefaultCopyright = myCopyrights.get(element.getAttributeValue(DEFAULT));
|
||||
myOptions.readExternal(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
for (CopyrightProfile copyright : myCopyrights.values()) {
|
||||
final Element copyrightElement = new Element(COPYRIGHT);
|
||||
copyright.writeExternal(copyrightElement);
|
||||
element.addContent(copyrightElement);
|
||||
}
|
||||
final Element map = new Element(MODULE2COPYRIGHT);
|
||||
for (String moduleName : myModule2Copyrights.keySet()) {
|
||||
final Element setting = new Element(ELEMENT);
|
||||
setting.setAttribute(MODULE, moduleName);
|
||||
setting.setAttribute(COPYRIGHT, myModule2Copyrights.get(moduleName));
|
||||
map.addContent(setting);
|
||||
}
|
||||
element.addContent(map);
|
||||
element.setAttribute(DEFAULT, myDefaultCopyright != null ? myDefaultCopyright.getName() : "");
|
||||
myOptions.writeExternal(element);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Element getState() {
|
||||
try {
|
||||
final Element e = new Element("settings");
|
||||
writeExternal(e);
|
||||
return e;
|
||||
Element state = new Element("settings");
|
||||
if (!myCopyrights.isEmpty()) {
|
||||
for (CopyrightProfile copyright : myCopyrights.values()) {
|
||||
final Element copyrightElement = new Element(COPYRIGHT);
|
||||
copyright.writeExternal(copyrightElement);
|
||||
state.addContent(copyrightElement);
|
||||
}
|
||||
}
|
||||
|
||||
if (!myModuleToCopyrights.isEmpty()) {
|
||||
final Element map = new Element(MODULE2COPYRIGHT);
|
||||
for (String moduleName : myModuleToCopyrights.keySet()) {
|
||||
final Element setting = new Element(ELEMENT);
|
||||
setting.setAttribute(MODULE, moduleName);
|
||||
setting.setAttribute(COPYRIGHT, myModuleToCopyrights.get(moduleName));
|
||||
map.addContent(setting);
|
||||
}
|
||||
state.addContent(map);
|
||||
}
|
||||
|
||||
if (myDefaultCopyright != null) {
|
||||
state.setAttribute(DEFAULT, myDefaultCopyright.getName());
|
||||
}
|
||||
|
||||
myOptions.writeExternal(state);
|
||||
|
||||
return state.getChildren().isEmpty() && state.getAttributes().isEmpty() ? null : state;
|
||||
}
|
||||
catch (WriteExternalException e1) {
|
||||
LOG.error(e1);
|
||||
catch (WriteExternalException e) {
|
||||
LOG.error(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadState(Element state) {
|
||||
clearCopyrights();
|
||||
|
||||
final Element moduleToCopyright = state.getChild(MODULE2COPYRIGHT);
|
||||
if (moduleToCopyright != null) {
|
||||
for (Element element : moduleToCopyright.getChildren(ELEMENT)) {
|
||||
myModuleToCopyrights.put(element.getAttributeValue(MODULE), element.getAttributeValue(COPYRIGHT));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
readExternal(state);
|
||||
for (Element element : state.getChildren(COPYRIGHT)) {
|
||||
final CopyrightProfile copyrightProfile = new CopyrightProfile();
|
||||
copyrightProfile.readExternal(element);
|
||||
myCopyrights.put(copyrightProfile.getName(), copyrightProfile);
|
||||
}
|
||||
myDefaultCopyright = myCopyrights.get(StringUtil.notNullize(state.getAttributeValue(DEFAULT)));
|
||||
myOptions.readExternal(state);
|
||||
}
|
||||
catch (InvalidDataException e) {
|
||||
LOG.error(e);
|
||||
@@ -205,7 +204,7 @@ public class CopyrightManager extends AbstractProjectComponent implements JDOMEx
|
||||
}
|
||||
|
||||
public Map<String, String> getCopyrightsMapping() {
|
||||
return myModule2Copyrights;
|
||||
return myModuleToCopyrights;
|
||||
}
|
||||
|
||||
public void setDefaultCopyright(@Nullable CopyrightProfile copyright) {
|
||||
@@ -223,8 +222,8 @@ public class CopyrightManager extends AbstractProjectComponent implements JDOMEx
|
||||
|
||||
public void removeCopyright(CopyrightProfile copyrightProfile) {
|
||||
myCopyrights.values().remove(copyrightProfile);
|
||||
for (Iterator<String> it = myModule2Copyrights.keySet().iterator(); it.hasNext();) {
|
||||
final String profileName = myModule2Copyrights.get(it.next());
|
||||
for (Iterator<String> it = myModuleToCopyrights.keySet().iterator(); it.hasNext();) {
|
||||
final String profileName = myModuleToCopyrights.get(it.next());
|
||||
if (profileName.equals(copyrightProfile.getName())) {
|
||||
it.remove();
|
||||
}
|
||||
@@ -234,15 +233,15 @@ public class CopyrightManager extends AbstractProjectComponent implements JDOMEx
|
||||
public void clearCopyrights() {
|
||||
myDefaultCopyright = null;
|
||||
myCopyrights.clear();
|
||||
myModule2Copyrights.clear();
|
||||
myModuleToCopyrights.clear();
|
||||
}
|
||||
|
||||
public void mapCopyright(String scopeName, String copyrightProfileName) {
|
||||
myModule2Copyrights.put(scopeName, copyrightProfileName);
|
||||
myModuleToCopyrights.put(scopeName, copyrightProfileName);
|
||||
}
|
||||
|
||||
public void unmapCopyright(String scopeName) {
|
||||
myModule2Copyrights.remove(scopeName);
|
||||
myModuleToCopyrights.remove(scopeName);
|
||||
}
|
||||
|
||||
public Collection<CopyrightProfile> getCopyrights() {
|
||||
@@ -250,7 +249,7 @@ public class CopyrightManager extends AbstractProjectComponent implements JDOMEx
|
||||
}
|
||||
|
||||
public boolean hasAnyCopyrights() {
|
||||
return myDefaultCopyright != null || !myModule2Copyrights.isEmpty();
|
||||
return myDefaultCopyright != null || !myModuleToCopyrights.isEmpty();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -258,13 +257,13 @@ public class CopyrightManager extends AbstractProjectComponent implements JDOMEx
|
||||
final VirtualFile virtualFile = file.getVirtualFile();
|
||||
if (virtualFile == null || myOptions.getOptions(virtualFile.getFileType().getName()).getFileTypeOverride() == LanguageOptions.NO_COPYRIGHT) return null;
|
||||
final DependencyValidationManager validationManager = DependencyValidationManager.getInstance(myProject);
|
||||
for (String scopeName : myModule2Copyrights.keySet()) {
|
||||
for (String scopeName : myModuleToCopyrights.keySet()) {
|
||||
final NamedScope namedScope = validationManager.getScope(scopeName);
|
||||
if (namedScope != null) {
|
||||
final PackageSet packageSet = namedScope.getValue();
|
||||
if (packageSet != null) {
|
||||
if (packageSet.contains(file, validationManager)) {
|
||||
final CopyrightProfile profile = myCopyrights.get(myModule2Copyrights.get(scopeName));
|
||||
final CopyrightProfile profile = myCopyrights.get(myModuleToCopyrights.get(scopeName));
|
||||
if (profile != null) {
|
||||
return profile;
|
||||
}
|
||||
@@ -330,7 +329,7 @@ public class CopyrightManager extends AbstractProjectComponent implements JDOMEx
|
||||
target.addContent(state);
|
||||
}
|
||||
for (Object attr : element.getAttributes()) {
|
||||
target.setAttribute((Attribute)((Attribute)attr).clone());
|
||||
target.setAttribute(((Attribute)attr).clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,13 @@
|
||||
|
||||
package com.maddyhome.idea.copyright.options;
|
||||
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.DefaultJDOMExternalizer;
|
||||
import com.intellij.openapi.util.DifferenceFilter;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import org.jdom.Element;
|
||||
|
||||
public class LanguageOptions implements JDOMExternalizable, Cloneable {
|
||||
public class LanguageOptions implements Cloneable {
|
||||
public static final int NO_COPYRIGHT = 1;
|
||||
public static final int USE_TEMPLATE = 2;
|
||||
public static final int USE_TEXT = 3;
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.maddyhome.idea.copyright.CopyrightUpdaters;
|
||||
import com.maddyhome.idea.copyright.psi.UpdateCopyrightsProvider;
|
||||
@@ -34,196 +33,161 @@ import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class Options implements JDOMExternalizable, Cloneable
|
||||
{
|
||||
public LanguageOptions getOptions(String name)
|
||||
{
|
||||
String lang = FileTypeUtil.getInstance().getFileTypeNameByName(name);
|
||||
LanguageOptions res = options.get(lang);
|
||||
if (res == null)
|
||||
{
|
||||
// NOTE: If any change is made here you need to update ConfigTabFactory and UpdateCopyrightFactory too.
|
||||
final FileType fileType = FileTypeUtil.getInstance().getFileTypeByName(name);
|
||||
if (fileType != null) {
|
||||
final UpdateCopyrightsProvider provider = CopyrightUpdaters.INSTANCE.forFileType(fileType);
|
||||
if (provider != null) return provider.getDefaultOptions();
|
||||
public class Options implements Cloneable {
|
||||
public LanguageOptions getOptions(String name) {
|
||||
String lang = FileTypeUtil.getInstance().getFileTypeNameByName(name);
|
||||
LanguageOptions res = options.get(lang);
|
||||
if (res == null) {
|
||||
// NOTE: If any change is made here you need to update ConfigTabFactory and UpdateCopyrightFactory too.
|
||||
final FileType fileType = FileTypeUtil.getInstance().getFileTypeByName(name);
|
||||
if (fileType != null) {
|
||||
final UpdateCopyrightsProvider provider = CopyrightUpdaters.INSTANCE.forFileType(fileType);
|
||||
if (provider != null) return provider.getDefaultOptions();
|
||||
}
|
||||
res = new LanguageOptions();
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public LanguageOptions getTemplateOptions() {
|
||||
return getOptions(LANG_TEMPLATE);
|
||||
}
|
||||
|
||||
public void setOptions(String name, LanguageOptions options) {
|
||||
String lang = FileTypeUtil.getInstance().getFileTypeNameByName(name);
|
||||
this.options.put(lang, options);
|
||||
}
|
||||
|
||||
public void setTemplateOptions(LanguageOptions options) {
|
||||
setOptions(LANG_TEMPLATE, options);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public LanguageOptions getMergedOptions(String name) {
|
||||
try {
|
||||
LanguageOptions lang = getOptions(name).clone();
|
||||
LanguageOptions temp = getTemplateOptions().clone();
|
||||
switch (lang.getFileTypeOverride()) {
|
||||
case LanguageOptions.USE_TEMPLATE:
|
||||
temp.setFileLocation(lang.getFileLocation());
|
||||
temp.setFileTypeOverride(lang.getFileTypeOverride());
|
||||
lang = temp;
|
||||
break;
|
||||
case LanguageOptions.USE_TEXT:
|
||||
break;
|
||||
}
|
||||
|
||||
return lang;
|
||||
}
|
||||
catch (CloneNotSupportedException e) {
|
||||
// This shouldn't happen
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void readExternal(Element element) throws InvalidDataException {
|
||||
logger.debug("readExternal()");
|
||||
List<Element> languageOptions = element.getChildren("LanguageOptions");
|
||||
if (languageOptions != null && !languageOptions.isEmpty()) {
|
||||
//noinspection ForLoopReplaceableByForEach
|
||||
for (int i = 0; i < languageOptions.size(); i++) {
|
||||
Element languageOption = languageOptions.get(i);
|
||||
// NOTE: If any change is made here you need to update ConfigTabFactory and UpdateCopyrightFactory too.
|
||||
LanguageOptions opts = new LanguageOptions();
|
||||
opts.readExternal(languageOption);
|
||||
setOptions(languageOption.getAttributeValue("name"), opts);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Element root = null;
|
||||
Element jOpts = element.getChild("JavaOptions");
|
||||
if (jOpts != null) // version 2.1.x
|
||||
{
|
||||
root = jOpts;
|
||||
}
|
||||
else // versions 0.0.1 - 2.0.x
|
||||
{
|
||||
Element child = element.getChild("option");
|
||||
if (child != null && child.getAttribute("name") != null) {
|
||||
root = element;
|
||||
}
|
||||
}
|
||||
if (root != null) {
|
||||
String languageName = StdFileTypes.JAVA.getName();
|
||||
// NOTE: If any change is made here you need to update ConfigTabFactory and UpdateCopyrightFactory too.
|
||||
LanguageOptions opts = new LanguageOptions();
|
||||
opts.setFileTypeOverride(LanguageOptions.USE_TEMPLATE);
|
||||
for (Object option : root.getChildren("option")) {
|
||||
String name = ((Element)option).getAttributeValue("name");
|
||||
String val = ((Element)option).getAttributeValue("value");
|
||||
if ("body".equals(name)) {
|
||||
//todo opts.setNotice(val);
|
||||
}
|
||||
else if ("location".equals(name)) {
|
||||
opts.setFileLocation(Integer.parseInt(val));
|
||||
}
|
||||
res = new LanguageOptions();
|
||||
}
|
||||
|
||||
return res;
|
||||
setOptions(languageName, opts);
|
||||
}
|
||||
}
|
||||
|
||||
public LanguageOptions getTemplateOptions()
|
||||
{
|
||||
return getOptions(LANG_TEMPLATE);
|
||||
logger.debug("options=" + this);
|
||||
}
|
||||
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
logger.debug("writeExternal()");
|
||||
|
||||
for (String lang : options.keySet()) {
|
||||
Element elem = new Element("LanguageOptions");
|
||||
elem.setAttribute("name", lang);
|
||||
element.addContent(elem);
|
||||
options.get(lang).writeExternal(elem);
|
||||
}
|
||||
|
||||
public void setOptions(String name, LanguageOptions options)
|
||||
{
|
||||
String lang = FileTypeUtil.getInstance().getFileTypeNameByName(name);
|
||||
this.options.put(lang, options);
|
||||
logger.debug("options=" + this);
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setTemplateOptions(LanguageOptions options)
|
||||
{
|
||||
setOptions(LANG_TEMPLATE, options);
|
||||
final Options options1 = (Options)o;
|
||||
|
||||
return options.equals(options1.options);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int result;
|
||||
result = options.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Options" + "{options=" + options + '}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public Options clone() throws CloneNotSupportedException {
|
||||
Options res = (Options)super.clone();
|
||||
res.options = new TreeMap<String, LanguageOptions>();
|
||||
for (String lang : options.keySet()) {
|
||||
LanguageOptions opts = options.get(lang);
|
||||
res.options.put(lang, opts.clone());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public LanguageOptions getMergedOptions(String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
LanguageOptions lang = getOptions(name).clone();
|
||||
LanguageOptions temp = getTemplateOptions().clone();
|
||||
switch (lang.getFileTypeOverride()){
|
||||
case LanguageOptions.USE_TEMPLATE:
|
||||
temp.setFileLocation(lang.getFileLocation());
|
||||
temp.setFileTypeOverride(lang.getFileTypeOverride());
|
||||
lang = temp;
|
||||
break;
|
||||
case LanguageOptions.USE_TEXT:
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
return lang;
|
||||
}
|
||||
catch (CloneNotSupportedException e)
|
||||
{
|
||||
// This shouldn't happen
|
||||
}
|
||||
private Map<String, LanguageOptions> options = new TreeMap<String, LanguageOptions>();
|
||||
private static final String LANG_TEMPLATE = "__TEMPLATE__";
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void readExternal(Element element) throws InvalidDataException
|
||||
{
|
||||
logger.debug("readExternal()");
|
||||
List langs = element.getChildren("LanguageOptions");
|
||||
if (langs != null && langs.size() > 0)
|
||||
{
|
||||
//noinspection ForLoopReplaceableByForEach
|
||||
for (int i = 0; i < langs.size(); i++)
|
||||
{
|
||||
Element lang = (Element)langs.get(i);
|
||||
String name = lang.getAttributeValue("name");
|
||||
// NOTE: If any change is made here you need to update ConfigTabFactory and UpdateCopyrightFactory too.
|
||||
LanguageOptions opts = new LanguageOptions();
|
||||
opts.readExternal(lang);
|
||||
|
||||
setOptions(name, opts);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Element root = null;
|
||||
Element jOpts = element.getChild("JavaOptions");
|
||||
if (jOpts != null) // version 2.1.x
|
||||
{
|
||||
root = jOpts;
|
||||
}
|
||||
else // versions 0.0.1 - 2.0.x
|
||||
{
|
||||
Element child = element.getChild("option");
|
||||
if (child != null && child.getAttribute("name") != null)
|
||||
{
|
||||
root = element;
|
||||
}
|
||||
}
|
||||
if (root != null)
|
||||
{
|
||||
String lname = StdFileTypes.JAVA.getName();
|
||||
// NOTE: If any change is made here you need to update ConfigTabFactory and UpdateCopyrightFactory too.
|
||||
LanguageOptions opts = new LanguageOptions();
|
||||
opts.setFileTypeOverride(LanguageOptions.USE_TEMPLATE);
|
||||
List children = root.getChildren("option");
|
||||
for (Object option : children)
|
||||
{
|
||||
String name = ((Element)option).getAttributeValue("name");
|
||||
String val = ((Element)option).getAttributeValue("value");
|
||||
if ("body".equals(name))
|
||||
{
|
||||
//todo opts.setNotice(val);
|
||||
}
|
||||
else if ("location".equals(name))
|
||||
{
|
||||
opts.setFileLocation(Integer.parseInt(val));
|
||||
}
|
||||
}
|
||||
|
||||
setOptions(lname, opts);
|
||||
}
|
||||
}
|
||||
|
||||
logger.debug("options=" + this);
|
||||
}
|
||||
|
||||
public void writeExternal(Element element) throws WriteExternalException
|
||||
{
|
||||
logger.debug("writeExternal()");
|
||||
|
||||
for (String lang : options.keySet())
|
||||
{
|
||||
LanguageOptions opts = options.get(lang);
|
||||
|
||||
Element elem = new Element("LanguageOptions");
|
||||
elem.setAttribute("name", lang);
|
||||
element.addContent(elem);
|
||||
opts.writeExternal(elem);
|
||||
}
|
||||
|
||||
logger.debug("options=" + this);
|
||||
}
|
||||
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (this == o)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final Options options1 = (Options)o;
|
||||
|
||||
return options.equals(options1.options);
|
||||
}
|
||||
|
||||
public int hashCode()
|
||||
{
|
||||
int result;
|
||||
result = options.hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
final StringBuffer sb = new StringBuffer();
|
||||
sb.append("Options");
|
||||
sb.append("{options=").append(options);
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Options clone() throws CloneNotSupportedException
|
||||
{
|
||||
Options res = (Options)super.clone();
|
||||
res.options = new TreeMap<String, LanguageOptions>();
|
||||
for (String lang : options.keySet())
|
||||
{
|
||||
LanguageOptions opts = options.get(lang);
|
||||
res.options.put(lang, opts.clone());
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
private Map<String, LanguageOptions> options = new TreeMap<String, LanguageOptions>();
|
||||
private static final String LANG_TEMPLATE = "__TEMPLATE__";
|
||||
|
||||
private static final Logger logger = Logger.getInstance(Options.class.getName());
|
||||
private static final Logger logger = Logger.getInstance(Options.class.getName());
|
||||
}
|
||||
Reference in New Issue
Block a user